Access Error Messages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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!

Below is a function that will build you a table of Access and Jet errors. I got
it off the net some time back. I don't remember where, now. It's presented "as
is" with no warranties or guarantees. Beware of line wrap.

Hope this helps,
RD


Public Function AccessAndJetErrorsTable() As Boolean

Dim dbs As Database, tdf As TableDef, fld As DAO.Field
Dim rst As DAO.Recordset, lngCode As Long
Dim strAccessErr As String

Const conAppObjectError = "Application-defined or object-defined error"

On Error GoTo Error_AccessAndJetErrorsTable

' Create Errors table with ErrorNumber and ErrorDescription fields.

Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef("AccessAndJetErrors")
Set fld = tdf.CreateField("ErrorCode", dbLong)

tdf.Fields.Append fld
Set fld = tdf.CreateField("ErrorString", dbMemo)
tdf.Fields.Append fld
dbs.TableDefs.Append tdf

' Open recordset on Errors table.

Set rst = dbs.OpenRecordset("AccessAndJetErrors")

' Loop through error codes.

For lngCode = 0 To 4500

On Error Resume Next

' Raise each error.

strAccessErr = AccessError(lngCode)
DoCmd.Hourglass True

' Skip error numbers without associated strings.

If strAccessErr <> "" Then

' Skip codes that generate application or
' object-defined errors.

If strAccessErr <> conAppObjectError Then
' Add each error code and string to
' Errors table.

rst.AddNew
rst!ErrorCode = lngCode

' Append string to memo field.

rst!ErrorString.AppendChunk strAccessErr
rst.Update

End If
End If

Next lngCode

' Close recordset.

rst.Close
DoCmd.Hourglass False
RefreshDatabaseWindow
MsgBox "Access and Jet errors table created."

AccessAndJetErrorsTable = True

Exit_AccessAndJetErrorsTable:

Exit Function

Error_AccessAndJetErrorsTable:

MsgBox Err & ": " & Err.Description
AccessAndJetErrorsTable = False
Resume Exit_AccessAndJetErrorsTable

End Function
 
That's awesome thanks!



RD said:
Below is a function that will build you a table of Access and Jet errors. I got
it off the net some time back. I don't remember where, now. It's presented "as
is" with no warranties or guarantees. Beware of line wrap.

Hope this helps,
RD


Public Function AccessAndJetErrorsTable() As Boolean

Dim dbs As Database, tdf As TableDef, fld As DAO.Field
Dim rst As DAO.Recordset, lngCode As Long
Dim strAccessErr As String

Const conAppObjectError = "Application-defined or object-defined error"

On Error GoTo Error_AccessAndJetErrorsTable

' Create Errors table with ErrorNumber and ErrorDescription fields.

Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef("AccessAndJetErrors")
Set fld = tdf.CreateField("ErrorCode", dbLong)

tdf.Fields.Append fld
Set fld = tdf.CreateField("ErrorString", dbMemo)
tdf.Fields.Append fld
dbs.TableDefs.Append tdf

' Open recordset on Errors table.

Set rst = dbs.OpenRecordset("AccessAndJetErrors")

' Loop through error codes.

For lngCode = 0 To 4500

On Error Resume Next

' Raise each error.

strAccessErr = AccessError(lngCode)
DoCmd.Hourglass True

' Skip error numbers without associated strings.

If strAccessErr <> "" Then

' Skip codes that generate application or
' object-defined errors.

If strAccessErr <> conAppObjectError Then
' Add each error code and string to
' Errors table.

rst.AddNew
rst!ErrorCode = lngCode

' Append string to memo field.

rst!ErrorString.AppendChunk strAccessErr
rst.Update

End If
End If

Next lngCode

' Close recordset.

rst.Close
DoCmd.Hourglass False
RefreshDatabaseWindow
MsgBox "Access and Jet errors table created."

AccessAndJetErrorsTable = True

Exit_AccessAndJetErrorsTable:

Exit Function

Error_AccessAndJetErrorsTable:

MsgBox Err & ": " & Err.Description
AccessAndJetErrorsTable = False
Resume Exit_AccessAndJetErrorsTable

End Function
 
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
 
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!


David C. Holley said:
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
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!
 
The code as is WONT because of the EXIT SUB statement. To test a Error
handling routine using the Err.Raise method to fake an error. That
should trigger it. Add the line Err.Raise 2279 right after the On Error
statement. Also, Its a good idea to include a CASE ELSE to display a
general error if something else happens.
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
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!
 
Okay, so this is my code now,

Private Sub FEntryDate_AfterUpdate()
On Error GoTo Err_FEntryDate_AfterUpdate

err.raise 2279

then etc.

But it still didn't trigger. I even put a break on the err.raise line. Any
other suggestions?

I should mention this is a field in a subform on a form.


David C. Holley said:
The code as is WONT because of the EXIT SUB statement. To test a Error
handling routine using the Err.Raise method to fake an error. That
should trigger it. Add the line Err.Raise 2279 right after the On Error
statement. Also, Its a good idea to include a CASE ELSE to display a
general error if something else happens.
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!
 
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!


David C. Holley said:
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
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!
 
Put in a STOP as the first line BEFORE the On Error. This will cause the
code halt and display the VBEditor. From there use the F8 function key
to step through the code, this will show you exactly what's happening.
(I've been walking in the Sun all day and don't recall the exact code
that you have.)
Okay, so this is my code now,

Private Sub FEntryDate_AfterUpdate()
On Error GoTo Err_FEntryDate_AfterUpdate

err.raise 2279

then etc.

But it still didn't trigger. I even put a break on the err.raise line. Any
other suggestions?

I should mention this is a field in a subform on a form.


:

The code as is WONT because of the EXIT SUB statement. To test a Error
handling routine using the Err.Raise method to fake an error. That
should trigger it. Add the line Err.Raise 2279 right after the On Error
statement. Also, Its a good idea to include a CASE ELSE to display a
general error if something else happens.
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!
 
I've been in the SUN a lot.
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!
 
Okay, from the beginning.... I have a form that has a subform in it. In the
subform, there is a field that is used for a date. I have the short date
input mask - 99/99/00;0;_ in this field, however if the user accidentally
enters a letter instead of a number or enters 10/10/2005 accidently they get
the error - "The value you entered isn't appropriate for the input mask etc,
etc. -Error number 2279. So in the after update event of the date field I
have the code I mentioned earlier. I have put a break in, but the message
comes up without even triggering the break. If you want to recreate the
problem, create a date field with a short date input mask, but delete two of
the "year" zeros because my user doesn't like to enter the full year just the
two digits - and maybe this is what is causing my problem, I don't know. I
would just like to have better message that says something like "Please enter
the date as **/**/**." because the user seems to get this message frequently
and asked if it could be made more user friendly.

Thanks again for any help!


RD said:
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!


David C. Holley said:
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!
 
I envy you. Is your office located right on the beach or something? I'm happy
that my cubicle has a window to the parking lot!
 
Ah, those pesky users.

I tried to recreate your situation but when I enter a letter or a four digit
year, nothing happens but a ding. The mask works perfectly.

Is your mask on the form field or the table field?

Maybe you should slap your user?

Kidding. KIDDING!


Okay, from the beginning.... I have a form that has a subform in it. In the
subform, there is a field that is used for a date. I have the short date
input mask - 99/99/00;0;_ in this field, however if the user accidentally
enters a letter instead of a number or enters 10/10/2005 accidently they get
the error - "The value you entered isn't appropriate for the input mask etc,
etc. -Error number 2279. So in the after update event of the date field I
have the code I mentioned earlier. I have put a break in, but the message
comes up without even triggering the break. If you want to recreate the
problem, create a date field with a short date input mask, but delete two of
the "year" zeros because my user doesn't like to enter the full year just the
two digits - and maybe this is what is causing my problem, I don't know. I
would just like to have better message that says something like "Please enter
the date as **/**/**." because the user seems to get this message frequently
and asked if it could be made more user friendly.

Thanks again for any help!


RD said:
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!
 
Hey! There's a lot to be said about Slapping a user - it REALLY does
work and is quite effective at making you feel better
Ah, those pesky users.

I tried to recreate your situation but when I enter a letter or a four digit
year, nothing happens but a ding. The mask works perfectly.

Is your mask on the form field or the table field?

Maybe you should slap your user?

Kidding. KIDDING!


Okay, from the beginning.... I have a form that has a subform in it. In the
subform, there is a field that is used for a date. I have the short date
input mask - 99/99/00;0;_ in this field, however if the user accidentally
enters a letter instead of a number or enters 10/10/2005 accidently they get
the error - "The value you entered isn't appropriate for the input mask etc,
etc. -Error number 2279. So in the after update event of the date field I
have the code I mentioned earlier. I have put a break in, but the message
comes up without even triggering the break. If you want to recreate the
problem, create a date field with a short date input mask, but delete two of
the "year" zeros because my user doesn't like to enter the full year just the
two digits - and maybe this is what is causing my problem, I don't know. I
would just like to have better message that says something like "Please enter
the date as **/**/**." because the user seems to get this message frequently
and asked if it could be made more user friendly.

Thanks again for any help!


:

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!
 
Back
Top