beanbeanbean
Registered User.
- Local time
- Today, 05:24
- Joined
- Sep 17, 2008
- Messages
- 124
hi guys. may i request for your help please ? i'm currently trying to do a button with a code that has an auto increment funtion. This means when every i press the button the number will gradually increase by 1. currently the code below is what i have but it does not seem to work. anyone willing to help. would really appreciate your help. thanks
Option Compare Database
Public Function NewCustID() As Long
On Error GoTo NextID_Err
Dim lngNextID As Long
'Find highest Employee ID in the tblPracticeEmployeeData table and add 1
lngNextID = DMax("[ID]", "Authorised_Listing") + 1
'Assign function the value of the Next ID
NewCustID = lngNextID
'Exit function now after successful incrementing or after error message
Exit_NewCustID:
Exit Function
'If an error occurred, display a message, then go to Exit statement
NextID_Err:
MsgBox "Error " & Err & ": " & Error(Err)
Resume Exit_NewCustID
End Function
Option Compare Database
Public Function NewCustID() As Long
On Error GoTo NextID_Err
Dim lngNextID As Long
'Find highest Employee ID in the tblPracticeEmployeeData table and add 1
lngNextID = DMax("[ID]", "Authorised_Listing") + 1
'Assign function the value of the Next ID
NewCustID = lngNextID
'Exit function now after successful incrementing or after error message
Exit_NewCustID:
Exit Function
'If an error occurred, display a message, then go to Exit statement
NextID_Err:
MsgBox "Error " & Err & ": " & Error(Err)
Resume Exit_NewCustID
End Function