I am trying to add an incrementing 4 digit number to the middle of a string. The incrementing number is not working. Here is a sample of my code:
Private Sub Form_Current()
Dim intYearDiff As Integer
intYearDiff = Right(DMax("[invoice_No]", "invoice", 2) - Format(Date, "yy"
'creates the difference between the years so that each year,index begins at yyyy0001'
If Me.NewRecord Then
Select Case intYearDiff
Case 0
Me.[INVOICE_NO] = "LB-" & Format(Date, "yy" Right(Left(DMax("[invoice_no]", "invoice", 7), 4) + 1 & Format(Date, "yy"
Case 1
Me.[INVOICE_NO] = "0001" & Format(Date, "yy"
End Select
End If
End Sub
Any help on this qould be greatly appreciated.
Private Sub Form_Current()
Dim intYearDiff As Integer
intYearDiff = Right(DMax("[invoice_No]", "invoice", 2) - Format(Date, "yy"
'creates the difference between the years so that each year,index begins at yyyy0001'
If Me.NewRecord Then
Select Case intYearDiff
Case 0
Me.[INVOICE_NO] = "LB-" & Format(Date, "yy" Right(Left(DMax("[invoice_no]", "invoice", 7), 4) + 1 & Format(Date, "yy"
Case 1
Me.[INVOICE_NO] = "0001" & Format(Date, "yy"
End Select
End If
End Sub
Any help on this qould be greatly appreciated.