Hi All...should be an easy one

hardhitter06

Registered User.
Local time
Today, 12:32
Joined
Dec 21, 2006
Messages
600
I have this code that increases a contract number by 1 for every new record under the "MU" category. What I need it to do is start counting from the current MUs in the database since I converted this over along with the old files. So I need it to start counting from the current one which is around 300. I had help with writing this code since I'm new to the game so how wquld I go about making this small change?


Private Sub Category_AfterUpdate()
Dim MUcounter As Long

If Not IsNumeric([Forms]![frmContract(input)]![frmSubfrm]![Contract #]) Then
MUcounter = Right([Forms]![frmContract(input)]![frmSubfrm]![Contract #], 4)
Else
MUcounter = [Forms]![frmContract(input)]![frmSubfrm]![Contract #]
End If

MUcounter = MUcounter + 1

If Me!Category = 7 Then
Me![Contract #] = "MU" & Format(MUcounter, "0000")
Else
Me![Contract #] = InputBox("Enter Contract Number")
End If

Thanks for your help.
 
use dmax to get the largest # and increment from there
 
Like I said I'm kind of new to code...you think you could show me what the code would look like. I'm currently searching about DMax in the meantime.
 

Users who are viewing this thread

Back
Top Bottom