A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can you disable the debugger?



 
 
Thread Tools Display Modes
  #11  
Old January 11th, 2005, 09:13 PM
pokdbz
external usenet poster
 
Posts: n/a
Default

Yes this is the right error is say Run-time error 2279 then something about
an incorrect mask.

Also when it goes into the debugger it goes to this statement on the
Me.Refresh line

Private Sub Patient_Entry_Click()
Me.Refresh 'used to refresh screen so new study entry's come up on main
form.
Sex.SetFocus
End Sub

maybe that is what is messing everything up.


"BruceM" wrote:

Make the Resume line BirthDate rather than the leftover control name in the
code I copied from one of my projects but did not fully modify. You have
determined for sure that it is error 2279 (perhpas by entering an incorrect
format on purpose)?

"pokdbz" wrote:

That didn't seem to catch the error here is what I put in:
Private Sub BirthDate_AfterUpdate()

On Error GoTo Err_BrithDate_AfterUpdate

Exit_BirthDate_AfterUpdate:
Exit Sub

Err_BirthDate_AfterUpdate:

If Err.Number = 2279 Then
MsgBox "Incorrect date format", vbCritical, "Format Error"
Else: MsgBox "Error #: " & Err.Number & " " & Err.description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

Did I do something wrong? Do you have any other suggestions?


"BruceM" wrote:

In general you could have something like this in the after update event for
the text box (named txtDate in this example):

Private Sub txtDate_AfterUpdate()

On Error GoTo Err_txtDate_AfterUpdate

Exit_txtDate_AfterUpdate:
Exit Sub

Err_txtDate_AfterUpdate:
msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_txtDate_AfterUpdate

End Sub

In the example, Err_txtDate_AfterUpdate: is a line label. GoTo sends the
code there in case of an error. The error message will give you an error
number (let's say 1234). Now change the above code with the following after
Err_txtDate_AfterUpdate:

If Err.Number = 1234 Then
msgbox "Incorrect date format", vbCritical, "Format Error"
Else: msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

By the way, check Visual Basic help rather than Access Help. It is often
more complete on this sort of thing.

"pokdbz" wrote:

I have tried looking and found the Error Handling part but could not many any
sense of it of what to do and how to impliment it into my current situation.
Any suggestions

"Larry Daugherty" wrote:

Look in Access Help for Error Handling.

HTH
--
-Larry-
--

"pokdbz" wrote in message
...
Maybe you can help? The problem is with a mask on a date field. If a
person
mistypes something or doesn't put in a valid date and tries to go to the
next
text box it says that it is the wrong date and then goes into the
debugger.
How is this avoidable can you use the on error since it is not in a
subroutine. Any suggestions? Or how can I set up something to catch the
error
before it goes into the debugger?
Thanks

"Ken Snell [MVP]" wrote:

Eliminate what's causing the error; or put in an error handler that
traps
the error and does something with it, even if ignoring it.

See On Error statement in Help file for more info.
--

Ken Snell
MS ACCESS MVP



"pokdbz" wrote in message
...
I have an error which brings up the debugger screen to end of debug.
Is
there a way to stop this from happening.







  #12  
Old January 12th, 2005, 01:13 PM
BruceM
external usenet poster
 
Posts: n/a
Default

Hard to tell with the line breaks in the newsreader, but is that two separate
lines of code (it should be), and does the comment occupy just one line in
your code window? Also, your code probably needs to be Me.Sex.SetFocus,
assuming Sex is the name of a control on the form.
You could turn those lines into remarks with an apostrophe and try the code
again.


"pokdbz" wrote:

Yes this is the right error is say Run-time error 2279 then something about
an incorrect mask.

Also when it goes into the debugger it goes to this statement on the
Me.Refresh line

Private Sub Patient_Entry_Click()
Me.Refresh 'used to refresh screen so new study entry's come up on main
form.
Sex.SetFocus
End Sub

maybe that is what is messing everything up.


"BruceM" wrote:

Make the Resume line BirthDate rather than the leftover control name in the
code I copied from one of my projects but did not fully modify. You have
determined for sure that it is error 2279 (perhpas by entering an incorrect
format on purpose)?

"pokdbz" wrote:

That didn't seem to catch the error here is what I put in:
Private Sub BirthDate_AfterUpdate()

On Error GoTo Err_BrithDate_AfterUpdate

Exit_BirthDate_AfterUpdate:
Exit Sub

Err_BirthDate_AfterUpdate:

If Err.Number = 2279 Then
MsgBox "Incorrect date format", vbCritical, "Format Error"
Else: MsgBox "Error #: " & Err.Number & " " & Err.description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

Did I do something wrong? Do you have any other suggestions?


"BruceM" wrote:

In general you could have something like this in the after update event for
the text box (named txtDate in this example):

Private Sub txtDate_AfterUpdate()

On Error GoTo Err_txtDate_AfterUpdate

Exit_txtDate_AfterUpdate:
Exit Sub

Err_txtDate_AfterUpdate:
msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_txtDate_AfterUpdate

End Sub

In the example, Err_txtDate_AfterUpdate: is a line label. GoTo sends the
code there in case of an error. The error message will give you an error
number (let's say 1234). Now change the above code with the following after
Err_txtDate_AfterUpdate:

If Err.Number = 1234 Then
msgbox "Incorrect date format", vbCritical, "Format Error"
Else: msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

By the way, check Visual Basic help rather than Access Help. It is often
more complete on this sort of thing.

"pokdbz" wrote:

I have tried looking and found the Error Handling part but could not many any
sense of it of what to do and how to impliment it into my current situation.
Any suggestions

"Larry Daugherty" wrote:

Look in Access Help for Error Handling.

HTH
--
-Larry-
--

"pokdbz" wrote in message
...
Maybe you can help? The problem is with a mask on a date field. If a
person
mistypes something or doesn't put in a valid date and tries to go to the
next
text box it says that it is the wrong date and then goes into the
debugger.
How is this avoidable can you use the on error since it is not in a
subroutine. Any suggestions? Or how can I set up something to catch the
error
before it goes into the debugger?
Thanks

"Ken Snell [MVP]" wrote:

Eliminate what's causing the error; or put in an error handler that
traps
the error and does something with it, even if ignoring it.

See On Error statement in Help file for more info.
--

Ken Snell
MS ACCESS MVP



"pokdbz" wrote in message
...
I have an error which brings up the debugger screen to end of debug.
Is
there a way to stop this from happening.







  #13  
Old January 12th, 2005, 02:31 PM
pokdbz
external usenet poster
 
Posts: n/a
Default

Yes that is just the problem with the newsreader. It is all on one line
commented correctly. I just can't me the debugger stop after a incorrect
date is input. Just to let you know maybe there is something wrong with the
mask. Here is what I have for the mask: 99/99/0000;0;*

"BruceM" wrote:

Hard to tell with the line breaks in the newsreader, but is that two separate
lines of code (it should be), and does the comment occupy just one line in
your code window? Also, your code probably needs to be Me.Sex.SetFocus,
assuming Sex is the name of a control on the form.
You could turn those lines into remarks with an apostrophe and try the code
again.


"pokdbz" wrote:

Yes this is the right error is say Run-time error 2279 then something about
an incorrect mask.

Also when it goes into the debugger it goes to this statement on the
Me.Refresh line

Private Sub Patient_Entry_Click()
Me.Refresh 'used to refresh screen so new study entry's come up on main
form.
Sex.SetFocus
End Sub

maybe that is what is messing everything up.


"BruceM" wrote:

Make the Resume line BirthDate rather than the leftover control name in the
code I copied from one of my projects but did not fully modify. You have
determined for sure that it is error 2279 (perhpas by entering an incorrect
format on purpose)?

"pokdbz" wrote:

That didn't seem to catch the error here is what I put in:
Private Sub BirthDate_AfterUpdate()

On Error GoTo Err_BrithDate_AfterUpdate

Exit_BirthDate_AfterUpdate:
Exit Sub

Err_BirthDate_AfterUpdate:

If Err.Number = 2279 Then
MsgBox "Incorrect date format", vbCritical, "Format Error"
Else: MsgBox "Error #: " & Err.Number & " " & Err.description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

Did I do something wrong? Do you have any other suggestions?


"BruceM" wrote:

In general you could have something like this in the after update event for
the text box (named txtDate in this example):

Private Sub txtDate_AfterUpdate()

On Error GoTo Err_txtDate_AfterUpdate

Exit_txtDate_AfterUpdate:
Exit Sub

Err_txtDate_AfterUpdate:
msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_txtDate_AfterUpdate

End Sub

In the example, Err_txtDate_AfterUpdate: is a line label. GoTo sends the
code there in case of an error. The error message will give you an error
number (let's say 1234). Now change the above code with the following after
Err_txtDate_AfterUpdate:

If Err.Number = 1234 Then
msgbox "Incorrect date format", vbCritical, "Format Error"
Else: msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

By the way, check Visual Basic help rather than Access Help. It is often
more complete on this sort of thing.

"pokdbz" wrote:

I have tried looking and found the Error Handling part but could not many any
sense of it of what to do and how to impliment it into my current situation.
Any suggestions

"Larry Daugherty" wrote:

Look in Access Help for Error Handling.

HTH
--
-Larry-
--

"pokdbz" wrote in message
...
Maybe you can help? The problem is with a mask on a date field. If a
person
mistypes something or doesn't put in a valid date and tries to go to the
next
text box it says that it is the wrong date and then goes into the
debugger.
How is this avoidable can you use the on error since it is not in a
subroutine. Any suggestions? Or how can I set up something to catch the
error
before it goes into the debugger?
Thanks

"Ken Snell [MVP]" wrote:

Eliminate what's causing the error; or put in an error handler that
traps
the error and does something with it, even if ignoring it.

See On Error statement in Help file for more info.
--

Ken Snell
MS ACCESS MVP



"pokdbz" wrote in message
...
I have an error which brings up the debugger screen to end of debug.
Is
there a way to stop this from happening.







  #14  
Old January 12th, 2005, 08:23 PM
BruceM
external usenet poster
 
Posts: n/a
Default

If the table has date/time as the data type and the text box is formatted
mm/dd/yyyy then any legitimate date will show in the format you want. If the
user enters 1/28, however, Access will change it to 01/01/1928. On the other
hand, if the user enters 1/2 Access will assume the current year and change
it to 01/02/2005. 1/1/4 becomes 01/01/2004. An input mask for a date is
sort of redundant since you can establish a date format. If you must have
one then 00/00/00;;* is as good as anything, I suppose, along with the
mm/dd/yyyy format. A two-digit year will automatically resolve itself to a
four-digit year without generating unnecessary errors. I would leave out the
0 after the first semi-colon, as there is no need I can see to store literal
values.
In my experience most users prefer a format that allows them to enter the
minimum amount of information. You may want to reconsider requiring eight
keystrokes for 02/05/2005 when 2/5 will accomplish the same thing.
Having said all that, the user applying an incorrect format generates an
error, but your error handling code is apparently incorrect. It is not the
error itself that opens the debugger but rather the procedure the code is
attempting to follow. It never gets a chance to run through all of the
instructions before it encounters some VBA no-no. It could just be some
simple formatting. Why don't you post the full AfterUpdate code? This
shouldn't be as complicated as it has become.
"pokdbz" wrote:

Yes that is just the problem with the newsreader. It is all on one line
commented correctly. I just can't me the debugger stop after a incorrect
date is input. Just to let you know maybe there is something wrong with the
mask. Here is what I have for the mask: 99/99/0000;0;*

"BruceM" wrote:

Hard to tell with the line breaks in the newsreader, but is that two separate
lines of code (it should be), and does the comment occupy just one line in
your code window? Also, your code probably needs to be Me.Sex.SetFocus,
assuming Sex is the name of a control on the form.
You could turn those lines into remarks with an apostrophe and try the code
again.


"pokdbz" wrote:

Yes this is the right error is say Run-time error 2279 then something about
an incorrect mask.

Also when it goes into the debugger it goes to this statement on the
Me.Refresh line

Private Sub Patient_Entry_Click()
Me.Refresh 'used to refresh screen so new study entry's come up on main
form.
Sex.SetFocus
End Sub

maybe that is what is messing everything up.


"BruceM" wrote:

Make the Resume line BirthDate rather than the leftover control name in the
code I copied from one of my projects but did not fully modify. You have
determined for sure that it is error 2279 (perhpas by entering an incorrect
format on purpose)?

"pokdbz" wrote:

That didn't seem to catch the error here is what I put in:
Private Sub BirthDate_AfterUpdate()

On Error GoTo Err_BrithDate_AfterUpdate

Exit_BirthDate_AfterUpdate:
Exit Sub

Err_BirthDate_AfterUpdate:

If Err.Number = 2279 Then
MsgBox "Incorrect date format", vbCritical, "Format Error"
Else: MsgBox "Error #: " & Err.Number & " " & Err.description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

Did I do something wrong? Do you have any other suggestions?


"BruceM" wrote:

In general you could have something like this in the after update event for
the text box (named txtDate in this example):

Private Sub txtDate_AfterUpdate()

On Error GoTo Err_txtDate_AfterUpdate

Exit_txtDate_AfterUpdate:
Exit Sub

Err_txtDate_AfterUpdate:
msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_txtDate_AfterUpdate

End Sub

In the example, Err_txtDate_AfterUpdate: is a line label. GoTo sends the
code there in case of an error. The error message will give you an error
number (let's say 1234). Now change the above code with the following after
Err_txtDate_AfterUpdate:

If Err.Number = 1234 Then
msgbox "Incorrect date format", vbCritical, "Format Error"
Else: msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

By the way, check Visual Basic help rather than Access Help. It is often
more complete on this sort of thing.

"pokdbz" wrote:

I have tried looking and found the Error Handling part but could not many any
sense of it of what to do and how to impliment it into my current situation.
Any suggestions

"Larry Daugherty" wrote:

Look in Access Help for Error Handling.

HTH
--
-Larry-
--

"pokdbz" wrote in message
...
Maybe you can help? The problem is with a mask on a date field. If a
person
mistypes something or doesn't put in a valid date and tries to go to the
next
text box it says that it is the wrong date and then goes into the
debugger.
How is this avoidable can you use the on error since it is not in a
subroutine. Any suggestions? Or how can I set up something to catch the
error
before it goes into the debugger?
Thanks

"Ken Snell [MVP]" wrote:

Eliminate what's causing the error; or put in an error handler that
traps
the error and does something with it, even if ignoring it.

See On Error statement in Help file for more info.
--

Ken Snell
MS ACCESS MVP



"pokdbz" wrote in message
...
I have an error which brings up the debugger screen to end of debug.
Is
there a way to stop this from happening.







  #15  
Old January 12th, 2005, 08:47 PM
pokdbz
external usenet poster
 
Posts: n/a
Default

Yes this should have been this complicate. You know why because I put in
that stupid mask. I took it out completely (I thought that you had to put a
mask on the date) and it works find now. No debugger if something goes wrong
but a message comes up which I can live with. Thanks you for your patients
with me. It all worked out in the end and that is all that matters.
Thanks again for the help.
Eric

"BruceM" wrote:

If the table has date/time as the data type and the text box is formatted
mm/dd/yyyy then any legitimate date will show in the format you want. If the
user enters 1/28, however, Access will change it to 01/01/1928. On the other
hand, if the user enters 1/2 Access will assume the current year and change
it to 01/02/2005. 1/1/4 becomes 01/01/2004. An input mask for a date is
sort of redundant since you can establish a date format. If you must have
one then 00/00/00;;* is as good as anything, I suppose, along with the
mm/dd/yyyy format. A two-digit year will automatically resolve itself to a
four-digit year without generating unnecessary errors. I would leave out the
0 after the first semi-colon, as there is no need I can see to store literal
values.
In my experience most users prefer a format that allows them to enter the
minimum amount of information. You may want to reconsider requiring eight
keystrokes for 02/05/2005 when 2/5 will accomplish the same thing.
Having said all that, the user applying an incorrect format generates an
error, but your error handling code is apparently incorrect. It is not the
error itself that opens the debugger but rather the procedure the code is
attempting to follow. It never gets a chance to run through all of the
instructions before it encounters some VBA no-no. It could just be some
simple formatting. Why don't you post the full AfterUpdate code? This
shouldn't be as complicated as it has become.
"pokdbz" wrote:

Yes that is just the problem with the newsreader. It is all on one line
commented correctly. I just can't me the debugger stop after a incorrect
date is input. Just to let you know maybe there is something wrong with the
mask. Here is what I have for the mask: 99/99/0000;0;*

"BruceM" wrote:

Hard to tell with the line breaks in the newsreader, but is that two separate
lines of code (it should be), and does the comment occupy just one line in
your code window? Also, your code probably needs to be Me.Sex.SetFocus,
assuming Sex is the name of a control on the form.
You could turn those lines into remarks with an apostrophe and try the code
again.


"pokdbz" wrote:

Yes this is the right error is say Run-time error 2279 then something about
an incorrect mask.

Also when it goes into the debugger it goes to this statement on the
Me.Refresh line

Private Sub Patient_Entry_Click()
Me.Refresh 'used to refresh screen so new study entry's come up on main
form.
Sex.SetFocus
End Sub

maybe that is what is messing everything up.


"BruceM" wrote:

Make the Resume line BirthDate rather than the leftover control name in the
code I copied from one of my projects but did not fully modify. You have
determined for sure that it is error 2279 (perhpas by entering an incorrect
format on purpose)?

"pokdbz" wrote:

That didn't seem to catch the error here is what I put in:
Private Sub BirthDate_AfterUpdate()

On Error GoTo Err_BrithDate_AfterUpdate

Exit_BirthDate_AfterUpdate:
Exit Sub

Err_BirthDate_AfterUpdate:

If Err.Number = 2279 Then
MsgBox "Incorrect date format", vbCritical, "Format Error"
Else: MsgBox "Error #: " & Err.Number & " " & Err.description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

Did I do something wrong? Do you have any other suggestions?


"BruceM" wrote:

In general you could have something like this in the after update event for
the text box (named txtDate in this example):

Private Sub txtDate_AfterUpdate()

On Error GoTo Err_txtDate_AfterUpdate

Exit_txtDate_AfterUpdate:
Exit Sub

Err_txtDate_AfterUpdate:
msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_txtDate_AfterUpdate

End Sub

In the example, Err_txtDate_AfterUpdate: is a line label. GoTo sends the
code there in case of an error. The error message will give you an error
number (let's say 1234). Now change the above code with the following after
Err_txtDate_AfterUpdate:

If Err.Number = 1234 Then
msgbox "Incorrect date format", vbCritical, "Format Error"
Else: msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

By the way, check Visual Basic help rather than Access Help. It is often
more complete on this sort of thing.

"pokdbz" wrote:

I have tried looking and found the Error Handling part but could not many any
sense of it of what to do and how to impliment it into my current situation.
Any suggestions

"Larry Daugherty" wrote:

Look in Access Help for Error Handling.

HTH
--
-Larry-
--

"pokdbz" wrote in message
...
Maybe you can help? The problem is with a mask on a date field. If a
person
mistypes something or doesn't put in a valid date and tries to go to the
next
text box it says that it is the wrong date and then goes into the
debugger.
How is this avoidable can you use the on error since it is not in a
subroutine. Any suggestions? Or how can I set up something to catch the
error
before it goes into the debugger?
Thanks

"Ken Snell [MVP]" wrote:

Eliminate what's causing the error; or put in an error handler that
traps
the error and does something with it, even if ignoring it.

See On Error statement in Help file for more info.
--

Ken Snell
MS ACCESS MVP



"pokdbz" wrote in message
...
I have an error which brings up the debugger screen to end of debug.
Is
there a way to stop this from happening.







  #16  
Old January 13th, 2005, 01:23 PM
BruceM
external usenet poster
 
Posts: n/a
Default

Glad it worked out. You can still use the code from my first posting to
isolate the error message, and to have your own message box appear. Date
already has a format, which is why you don't need an input mask as you would
with a phone number or something of that sort.

"pokdbz" wrote:

Yes this should have been this complicate. You know why because I put in
that stupid mask. I took it out completely (I thought that you had to put a
mask on the date) and it works find now. No debugger if something goes wrong
but a message comes up which I can live with. Thanks you for your patients
with me. It all worked out in the end and that is all that matters.
Thanks again for the help.
Eric

"BruceM" wrote:

If the table has date/time as the data type and the text box is formatted
mm/dd/yyyy then any legitimate date will show in the format you want. If the
user enters 1/28, however, Access will change it to 01/01/1928. On the other
hand, if the user enters 1/2 Access will assume the current year and change
it to 01/02/2005. 1/1/4 becomes 01/01/2004. An input mask for a date is
sort of redundant since you can establish a date format. If you must have
one then 00/00/00;;* is as good as anything, I suppose, along with the
mm/dd/yyyy format. A two-digit year will automatically resolve itself to a
four-digit year without generating unnecessary errors. I would leave out the
0 after the first semi-colon, as there is no need I can see to store literal
values.
In my experience most users prefer a format that allows them to enter the
minimum amount of information. You may want to reconsider requiring eight
keystrokes for 02/05/2005 when 2/5 will accomplish the same thing.
Having said all that, the user applying an incorrect format generates an
error, but your error handling code is apparently incorrect. It is not the
error itself that opens the debugger but rather the procedure the code is
attempting to follow. It never gets a chance to run through all of the
instructions before it encounters some VBA no-no. It could just be some
simple formatting. Why don't you post the full AfterUpdate code? This
shouldn't be as complicated as it has become.
"pokdbz" wrote:

Yes that is just the problem with the newsreader. It is all on one line
commented correctly. I just can't me the debugger stop after a incorrect
date is input. Just to let you know maybe there is something wrong with the
mask. Here is what I have for the mask: 99/99/0000;0;*

"BruceM" wrote:

Hard to tell with the line breaks in the newsreader, but is that two separate
lines of code (it should be), and does the comment occupy just one line in
your code window? Also, your code probably needs to be Me.Sex.SetFocus,
assuming Sex is the name of a control on the form.
You could turn those lines into remarks with an apostrophe and try the code
again.


"pokdbz" wrote:

Yes this is the right error is say Run-time error 2279 then something about
an incorrect mask.

Also when it goes into the debugger it goes to this statement on the
Me.Refresh line

Private Sub Patient_Entry_Click()
Me.Refresh 'used to refresh screen so new study entry's come up on main
form.
Sex.SetFocus
End Sub

maybe that is what is messing everything up.


"BruceM" wrote:

Make the Resume line BirthDate rather than the leftover control name in the
code I copied from one of my projects but did not fully modify. You have
determined for sure that it is error 2279 (perhpas by entering an incorrect
format on purpose)?

"pokdbz" wrote:

That didn't seem to catch the error here is what I put in:
Private Sub BirthDate_AfterUpdate()

On Error GoTo Err_BrithDate_AfterUpdate

Exit_BirthDate_AfterUpdate:
Exit Sub

Err_BirthDate_AfterUpdate:

If Err.Number = 2279 Then
MsgBox "Incorrect date format", vbCritical, "Format Error"
Else: MsgBox "Error #: " & Err.Number & " " & Err.description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

Did I do something wrong? Do you have any other suggestions?


"BruceM" wrote:

In general you could have something like this in the after update event for
the text box (named txtDate in this example):

Private Sub txtDate_AfterUpdate()

On Error GoTo Err_txtDate_AfterUpdate

Exit_txtDate_AfterUpdate:
Exit Sub

Err_txtDate_AfterUpdate:
msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_txtDate_AfterUpdate

End Sub

In the example, Err_txtDate_AfterUpdate: is a line label. GoTo sends the
code there in case of an error. The error message will give you an error
number (let's say 1234). Now change the above code with the following after
Err_txtDate_AfterUpdate:

If Err.Number = 1234 Then
msgbox "Incorrect date format", vbCritical, "Format Error"
Else: msgbox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_imgCmdCal2nd_Click
End If

End Sub

By the way, check Visual Basic help rather than Access Help. It is often
more complete on this sort of thing.

"pokdbz" wrote:

I have tried looking and found the Error Handling part but could not many any
sense of it of what to do and how to impliment it into my current situation.
Any suggestions

"Larry Daugherty" wrote:

Look in Access Help for Error Handling.

HTH
--
-Larry-
--

"pokdbz" wrote in message
...
Maybe you can help? The problem is with a mask on a date field. If a
person
mistypes something or doesn't put in a valid date and tries to go to the
next
text box it says that it is the wrong date and then goes into the
debugger.
How is this avoidable can you use the on error since it is not in a
subroutine. Any suggestions? Or how can I set up something to catch the
error
before it goes into the debugger?
Thanks

"Ken Snell [MVP]" wrote:

Eliminate what's causing the error; or put in an error handler that
traps
the error and does something with it, even if ignoring it.

See On Error statement in Help file for more info.
--

Ken Snell
MS ACCESS MVP



"pokdbz" wrote in message
...
I have an error which brings up the debugger screen to end of debug.
Is
there a way to stop this from happening.







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Status of 'Disable Features' Issues [email protected] General Discussion 7 January 6th, 2005 10:42 PM
Disable "update links" dialog box in PowerPoint Ray Maas Powerpoint 1 December 30th, 2004 07:23 PM
how do i disable CTRL+< and CTRL+> Keith G Hicks Using Forms 7 October 15th, 2004 05:10 PM
Disable any key globally for complete database Irshad Alam Using Forms 1 August 17th, 2004 04:33 PM
Disable user to Maximize the form Irshad Alam Using Forms 0 August 15th, 2004 03:19 PM


All times are GMT +1. The time now is 12:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.