Hi all,
I'm sure one of you guys can spot the problem here? I have been banging my head against a brick wall for 2 hours
I am trying to find the highest Application_No and add 1 to it and then pass it to a text box. Easy right???
I'm sure one of you guys can spot the problem here? I have been banging my head against a brick wall for 2 hours
I am trying to find the highest Application_No and add 1 to it and then pass it to a text box. Easy right???
Code:
Private Sub Form_BeforeInsert(Cancel As Integer)
'curAppNo - Finds current highest Application_No
Dim curAppNo As Byte
curAppNo = Nz(DMax("Application_No", "APPLICATIONS", "Contract_No = [txtContractNo]"), 0)
'Adds 1 to the current highest
curAppNo = curAppNo + 1
'sets the value of next highest application
txtApplicationNo.Value = curAppNo
End Sub