Hey all,
I'm working on a project for my work and running into a small issue. This doesn't seem to have affected the Dmax function in my other database. It works fine there and continues to increment. However, in this new database I'm working on....
I have a function set up to look at the incidentid field in tbl_sup_queue and increment the highest number by 1. I have it set so that on the entry form load it does the following:
Look to tbl_sup_queue
Dmax +1 highest incidentid number
Save record (this is done as is multi-user to prevent duplicate incidentid numbers)
What is happening, is that Dmax is hitting incidentid number 10 and stopping. It will not increment further. I'm pasting the code below if anyone can help me out.
Thanks in advance -
I'm working on a project for my work and running into a small issue. This doesn't seem to have affected the Dmax function in my other database. It works fine there and continues to increment. However, in this new database I'm working on....
I have a function set up to look at the incidentid field in tbl_sup_queue and increment the highest number by 1. I have it set so that on the entry form load it does the following:
Look to tbl_sup_queue
Dmax +1 highest incidentid number
Save record (this is done as is multi-user to prevent duplicate incidentid numbers)
What is happening, is that Dmax is hitting incidentid number 10 and stopping. It will not increment further. I'm pasting the code below if anyone can help me out.
Thanks in advance -
Code:
Private Sub Form_Load()
Me![incidentid] = NewID()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub
Public Function NewID() As Long
On Error GoTo NextID_Err
Dim lngNewID As Long
lngNewID = DMax("[incidentid]", "tbl_sup_queue") + 1
'Assign function the value of the Next ID
NewID = lngNewID
'Exit function now after successful incrementing or after error message
Exit_NewID:
Exit Function
'If an error occurred, display a message, then go to Exit statement
NextID_Err:
MsgBox "Error " & Err & ": " & Error$
Resume Exit_NewID
End Function