View Full Version : Help With error Module


JBurlison
05-16-2008, 06:34 AM
Ok in my module i have:

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:

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.

gemma-the-husky
05-16-2008, 07:46 AM
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

JBurlison
05-16-2008, 07:55 AM
duh....i named the function and the module the same thing........