Ok ... I've read all the posts and replies. While I respect David very much, I
think he's missing something here. For that matter, I think we may all be
missing something here. A full explanation of what you're trying to do, your
code, and exactly the error(s) you're getting will go a long way to figuring out
what is going wrong and where it is doing so.
I do have another function that returns other error messages but I've found that
one rather useless and probably useless for what you're trying to acheive.
So, to me, it looks like your structure looks ok. On error go to this place.
If it doesn't go there, you must not be generating the error.
The process *is* logical. All we have to do is walk through it. Sometimes
forward is good ... sometimes backward is good. All depends on the logic.
So, have you stepped through the code and watched each value and whatnot? I see
the beginning and ending of your code but I suspect there may be more going on.
Are you positive that this is the error that is generated *every time*? Maybe
there is something else going on.
I dunno ... just fishing. I get so bogged down in my own projects that it's
sometimes a relief to work on soneone else's.
I'll be here (at home) all day on Monday (working on a problem child app that I
wish would go away). It's my day off but I'm working at least 8 hours. Helping
you out would afford me a welcome distraction.
Regards,
RD
Both of you were very helpful, thank you. But I'm still having a problem.
Here is the code I am using on my after update of the date field.
Private Sub FEntryDate_AfterUpdate()
On Error GoTo Err_FEntryDate_AfterUpdate
Exit_FEntryDate_AfterUpdate:
Exit Sub
Err_FEntryDate_AfterUpdate:
Select Case Err.Number
Case 2279
MsgBox "You must enter the date."
End Select
Resume Exit_FEntryDate_AfterUpdate
End Sub
But it doesn't seem to trigger, I keep getting the standard Access error
message. Any ideas?
Thanks!
:
There's some code out there that will snoop around the error messages
and create a table complete with error messages. It might even been in
Access help. Its seems to be pretty popular so it should be that
difficult to find. As to acutally doing vat you vant to do...
Add
On Error Goto mySub_Error
at the start of where you want to trap the errors, typically at the
start of the SUB or FUNCTION
at the end add
mySub_Exit: 'This and mySub_Error are called labels and used
Exit Sub 'for program flow. Error handlers typically reside
'at the bottom of the SUB/FUNCTION. The _Exit label
'is here to explicity EXIT the SUB otherwise the
'Code would continue on down to the Error handler
'For a practical example, create a button on a form
'that opens another form and then look at the code
'FYI if you need to turn of the On Error statement
'use On Error GoTo 0
'that will cause the Access to follow the general
'error handling options set in OPTIONS
mySub_Error:
Select Case err.number
Case [number here]
[do something, typically and error msg]
[and then RESUME to return to the next line of code or]
[Exit sub]
Case [number here]
Case [number here]
end Select
AT wrote:
Does anyone know where to find a list of the error numbers that are assigned
to the Access error messages that pop up? For example, I want to change the
"The value you entered isn't appropriate for the input mask...." to a little
better description, but I don't know where to find the number of the error.
Thanks!