Error Handling For Module- Not Working?

roystreet

Registered User.
Local time
Yesterday, 23:57
Joined
Aug 16, 2004
Messages
47
Hello,
I have a module which contains the following code:
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
 
You are missing a colon after the error handler's tag.
 

Users who are viewing this thread

Back
Top Bottom