Private Sub BtnTest_Click()
'Get Max Record Id, Max Ordnum Record, Max InvNumRecord
Dim maxrecord As Integer
maxrecord = DMax("[recnum]", "[srvinv]") + 1
Dim maxordnum As Integer
maxordnum = CInt(DMax("format([ordnum],""0000"")", "[srvinv]")) + 1
Dim maxinvnum As Integer
maxinvnum = CInt(DMax("format([invnum],""0000"")", "[srvinv]")) + 1
MsgBox "Max Record = " & maxrecord & "Max Order = " & maxordnum & "Max Inv = " & maxinv
End Sub
|