View Full Version : Error Handling For Module- Not Working?


roystreet
08-19-2004, 10:59 AM
Hello,
I have a module which contains the following code:

Public Function GenerateNumber(frm As Form) As Integer

On Error GoTo GenerateNumber_Err

frm.Unique_Number = Format(Nz(DMax("[DAA-MasterTable].Unique_Number", "DAA-MasterTable", "Standard_Number = '" & frm.Standard_Number & "' AND FY = '" & frm.FY & "'"), 0) + 1, "0000")

DoCmd.GoToControl "Employee_Name"
GenerateNumber_Exit:
Exit Function

GenerateNumber_Err
MsgBox "This will reflect some type of error - Possibly entering a new message since this error may occur for different reasons.", vbExclamation, "Error Generated By Number Generator Engine"
Resume GenerateNumber_Exit

End Function

But what I'm finding is on an error, runs the debugger and I can't figure out why. It is set up so that in case an error would occur, it would pop up a msgbox and would stop the user from going further. It states sub or function not defined. I've used this error style on other codes that were on the form and they worked just fine. I haven't it before on this specific code on a specific form.

Thanks,
---roystreet

Mile-O
08-19-2004, 11:22 AM
You are missing a colon after the error handler's tag.