Hi!
I'm trying to set a project number in this format 07-20-20-01; 07-20-20-02, etc. I've got it where it will now start at 1 on a new day, but it won't increment to the next number. Using this:
Any thoughts? I thank you in advance for your time!
I'm trying to set a project number in this format 07-20-20-01; 07-20-20-02, etc. I've got it where it will now start at 1 on a new day, but it won't increment to the next number. Using this:
Code:
Private Sub Command102_Click()
Dim vDate, vRet, vNum, vOrder
Dim i As Integer
DoCmd.GoToRecord , , acNewRec
Me.CreateDate = Date
DoCmd.RunCommand acCmdSave
vDate = Format(Date, "mm-dd-yy")
vRet = DMax("[createdate]", "DateVals", "[createdate]=" & vDate) 'find the max entry for the day
Debug.Print vRet
Debug.Print lastnumber
If IsNull(vRet) Then
vOrder = vDate & "-01"
Else
i = InStr(vRet, "-")
vNum = Mid(vRet, i + 1)
vNum = Val(vNum) + 1
Debug.Print vNum
Debug.Print vNum + 1
vOrder = vDate & "-" & Format(vNum, "000")
Debug.Print vOrder
End If
Any thoughts? I thank you in advance for your time!