To Allen Browne or anyone who can help handling error messages

S

Simone

Hello

Allan - Hi, the reason I am writing to you is that I found a thread
with some code you gave to someone that worked but didn't really work
for me.

The error I am getting is "sub or function not defined - Call
LogError"
This is the code
###################
Public Function FormError(frm As Form, DataErr As Integer, Response As
Integer) As Integer
On Error GoTo Err_FormError
'Purpose: Generic Form_Error handler.
'Return: Response.
'Usage: In a form's Error event procedure:
' Call FormError(Me, DataErr, Response)
Dim strMsg As String
Const conDupeIndex As Integer = 3022
Const conFileMissing As Integer = 3024
Const conRelatedRecordRequired As Integer = 3201
Const conRequiredField As Integer = 3314

Select Case DataErr
Case conDupeIndex
Response = acDataErrContinue
strMsg = "The record cannot be saved, as it would create a
duplicate."

Case conRelatedRecordRequired
Response = acDataErrDisplay

Case conRequiredField
strMsg = "This is a required field." & vbCrLf & vbCrLf & "Make
an
entry, or press <Esc> to undo."
Response = acDataErrContinue

Case conFileMissing
strMsg = "Data file is currently unavailable."
Response = acDataErrDisplay

Case Else
Response = acDataErrDisplay
End Select

If Len(strMsg) > 0 Then
MsgBox strMsg, vbExclamation, "Invalid data"
End If
FormError = Response

Exit_FormError:
Exit Function

Err_FormError:
Call LogError(Err.Number, Err.Description, "FormError()",
"DataErr: " & DataErr)
Resume Exit_FormError
End Function

###########################

Plus I wanted to ask if I still need to use >>>>>

If Me.Dirty Then
Me.Dirty = False
End If

to trap this error so it doesn't close without letting the user know
that didn't save.

The bottom line is I have a form with a couple required fields and I
want to display my message to the user not access error message AND
make sure it doesn't close and the user thinks it saved but it didn't.

Thanks, thanks, thanks.

Simone Dupre (from Florida) :)
 
B

Bruce M. Thompson

Allan - Hi, the reason I am writing to you is that I found a thread
with some code you gave to someone that worked but didn't really work
for me.

The error I am getting is "sub or function not defined - Call
LogError"

Go to the following page at Allen's site and scroll down about half way down the
page to find the function you are apparently missing:

http://members.iinet.net.au/~allenbrowne/ser-23a.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top