Autonumber for multiusers

R

rblivewire

I have this code that I use to trap a multinumber error and replace it
with one greater than the highest one:

Private Sub saveCloseButton_Click()
'On Error GoTo Err_saveCloseButton_Click
On Error GoTo Err_Form_Error

Response = IncrementField(DataErr)

If MsgBox("Are you sure you want to save and close this request?",
vbQuestion + vbYesNo) = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.Close

End If

'Exit_saveCloseButton_Click:
'Exit Sub

Exit_Form_Error:
Exit Sub

'Err_saveCloseButton_Click:
'MsgBox Err.Description
'Resume Exit_saveCloseButton_Click
' End If
Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error

End Sub

Function IncrementField(DataErr)
If DataErr = 3022 Then


Me![#] = (DMax("[#]", "Tool Tracking List") + 1)
IncrementField = acDataErrContinue
End If
End Function

When it gets to the function though it skips over:
Me![#] = (DMax("[#]", "Tool Tracking List") + 1)
IncrementField = acDataErrContinue

This is the main code I need it to run. Any reason why it skips over
this??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top