I am trying to add an incrementing 4 digit number to the middle of a string. The incrementing number is not working. There must be a better way of writing this. The result I would like should look like this: LB-0001-02. Where LB is static, 0001 is the incrementing number and 02 is the year. Here is a sample of my
code:
Private Sub Form_Current()
Dim intYearDiff As Integer
intYearDiff = DMax([Temp_inv#])(Left([Temp_inv#], 2) - Format(Date, "yy"))
If Me.NewRecord Then
Select Case intYearDiff
Case 0
DMax (Temp_Inv#) + 1
Case 1
30001 [Temp_inv#] [INVOICE_NO] = "LB" & Right(Temp_Inv#, 4) & "-" & Format(Date, "yy")
End Select
End If
End Sub
Any help on this qould be greatly appreciated.
code:
Private Sub Form_Current()
Dim intYearDiff As Integer
intYearDiff = DMax([Temp_inv#])(Left([Temp_inv#], 2) - Format(Date, "yy"))
If Me.NewRecord Then
Select Case intYearDiff
Case 0
DMax (Temp_Inv#) + 1
Case 1
30001 [Temp_inv#] [INVOICE_NO] = "LB" & Right(Temp_Inv#, 4) & "-" & Format(Date, "yy")
End Select
End If
End Sub
Any help on this qould be greatly appreciated.