Ok in my module i have:
I am trying to call it by:
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.
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.