Help With error Module

JBurlison

Registered User.
Local time
Today, 13:58
Joined
Mar 14, 2008
Messages
172
Ok in my module i have:
Code:
Public Function ErrorRPT()

Dim rserror As DAO.Recordset
Dim db As DAO.Database

On Error GoTo Errortxt

Set db = CurrentDb
Set rserror = db.OpenRecordset("Errors", dbOpenDynaset)


GoTo Endsubtxt
Errortxt:
MsgBox "The program has encounterd a error! The error has been recorded and sent to the database admin, ''Error: " & Err.Description & " Error Number: " & Err.Number & "''.", vbCritical + vbOKOnly, "Error!"

With rserror
    .AddNew
    .Fields("Error Reason") = Err.Description
    .Fields("User") = Forms![infokeeper]![Loginname]
    .Fields("Error Number") = Err.Number
    .Fields("Form Name") = CurrentObjectName
    .Update
End With
rserror.Close
Set rserror = Nothing

If DLookup("[Error Reporting]", "[User Name]", "[User Name] = '" & Forms![infokeeper]![Loginname] & "'") = "Yes" Then
    DoCmd.OpenForm "Error Comment", , , acLast, , acDialog
End If

Errortxt:
End Function

I am trying to call it by:

Code:
  On Error GoTo ErrorRPT
ErrorRPT:

Call ErrorRPT

But i get an error:

Expected procedure or variable not module

What am i doing wrong, this is my first time trying to call a module.
 
the module has errors in it at present

you have two labels called errortxt: and no label called endsubtxt:

try compiling it and see what happens

-------
normally access would give adebug error with an invalid module, but i would try compiling as a first step

if you still get the error, put a breakpoint in your error function, to trace the execution
 
duh....i named the function and the module the same thing........
 

Users who are viewing this thread

Back
Top Bottom