Sequential Number Help
I have created a command button on my form that when a user clicks it, it generates a serial# and places it into the serial# field on the form....the format for the serial# is Vyyww d ###
What I now need this to do is to reset the ### part each day...
here is the code I have created so far:
Private Sub Command11_Click()
Dim MyDate, MyYear, MyWeek, MyDay
Dim Ret As String
Dim GenerateSerial As String
Dim rs As Recordset
Dim MyNumber As String
MyDate = Date
MyYear = Format(Date, "yy")
MyWeek = Format(DatePart("ww", MyDate, vbUseSystemDayOfWeek, vbUseSystem), "00")
MyDay = Format(DatePart("w", MyDate, vbUseSystemDayOfWeek, vbUseSystem), "0")
MyNumber = Format(DMax("[Number]", "Table1") + 1, "000")
Ret = "V" & MyYear & MyWeek & " " & MyDay & " " & MyNumber
Forms!Form1!Serial = Ret
I have created a command button on my form that when a user clicks it, it generates a serial# and places it into the serial# field on the form....the format for the serial# is Vyyww d ###
What I now need this to do is to reset the ### part each day...
here is the code I have created so far:
Private Sub Command11_Click()
Dim MyDate, MyYear, MyWeek, MyDay
Dim Ret As String
Dim GenerateSerial As String
Dim rs As Recordset
Dim MyNumber As String
MyDate = Date
MyYear = Format(Date, "yy")
MyWeek = Format(DatePart("ww", MyDate, vbUseSystemDayOfWeek, vbUseSystem), "00")
MyDay = Format(DatePart("w", MyDate, vbUseSystemDayOfWeek, vbUseSystem), "0")
MyNumber = Format(DMax("[Number]", "Table1") + 1, "000")
Ret = "V" & MyYear & MyWeek & " " & MyDay & " " & MyNumber
Forms!Form1!Serial = Ret