Error problems

  • Thread starter Haggr1 via AccessMonster.com
  • Start date
H

Haggr1 via AccessMonster.com

Below is the code used to run 2 queries w/o error messages. But after
running "debug" a few months ago this code quit working: returning an error
message that I can't acknowledge thru. I can run each query independently
and acknowledge each potenial error (2-3) per query. "dbFailOnError" should
handle those??? Any Suggestions? Thanks

Private Sub Command49_Click()
On Error GoTo Err_Command49_Click

With CurrentDb
DoCmd.Hourglass True
.Execute "qrystyleappendstyle", dbFailOnError
.Execute "qrystylegary", dbFailOnError
End With

Exit_Command49_Click:
DoCmd.Hourglass False


Exit Sub

Err_Command49_Click:
MsgBox Err.Description
Resume Exit_Command49_Click

End Sub
 
S

Stuart McCall

Haggr1 via AccessMonster.com said:
Below is the code used to run 2 queries w/o error messages. But after
running "debug" a few months ago this code quit working: returning an
error
message that I can't acknowledge thru. I can run each query independently
and acknowledge each potenial error (2-3) per query. "dbFailOnError"
should
handle those??? Any Suggestions? Thanks

Private Sub Command49_Click()
On Error GoTo Err_Command49_Click

With CurrentDb
DoCmd.Hourglass True
.Execute "qrystyleappendstyle", dbFailOnError
.Execute "qrystylegary", dbFailOnError
End With

Exit_Command49_Click:
DoCmd.Hourglass False


Exit Sub

Err_Command49_Click:
MsgBox Err.Description
Resume Exit_Command49_Click

End Sub

Try inserting DoEvents between your query executions, to give Access time to
catch its own tail.
This may or may not be the solution, but its worth a quick trial...
 
H

Haggr1 via AccessMonster.com

If you mean as below still returns error message

Private Sub Command49_Click()
On Error GoTo Err_Command49_Click

With CurrentDb
DoCmd.Hourglass True
.Execute "qrystyleappendstyle", dbFailOnError
DoEvents
.Execute "qrystylegary", dbFailOnError
End With

Exit_Command49_Click:
DoCmd.Hourglass False


Exit Sub

Err_Command49_Click:
MsgBox Err.Description
Resume Exit_Command49_Click

End Sub
 
C

ChrisO

dbFailOnError should take you to the error handler on first error and the
error handler exits the Sub. Suggest you fix the errors in the queries.
 
H

Haggr1 via AccessMonster.com

Please, this can't be that hard for someone who knows what the are doing to
help me with. Please read my original post.
dbFailOnError should take you to the error handler on first error and the
error handler exits the Sub. Suggest you fix the errors in the queries.
Below is the code used to run 2 queries w/o error messages. But after
running "debug" a few months ago this code quit working: returning an error
[quoted text clipped - 21 lines]
 
J

John Spencer

You didn't post what the error is. That would help in terms of diagnosis and
in the possibility of suggesting a solution.

Also, it might help if you posted the SQL statements of the queries you are
trying to execute.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Please, this can't be that hard for someone who knows what the are doing to
help me with. Please read my original post.
dbFailOnError should take you to the error handler on first error and the
error handler exits the Sub. Suggest you fix the errors in the queries.
Below is the code used to run 2 queries w/o error messages. But after
running "debug" a few months ago this code quit working: returning an error
[quoted text clipped - 21 lines]
 
D

Dirk Goldgar

Haggr1 via AccessMonster.com said:
Below is the code used to run 2 queries w/o error messages. But after
running "debug" a few months ago this code quit working: returning an
error
message that I can't acknowledge thru. I can run each query independently
and acknowledge each potenial error (2-3) per query. "dbFailOnError"
should
handle those??? Any Suggestions? Thanks

Private Sub Command49_Click()
On Error GoTo Err_Command49_Click

With CurrentDb
DoCmd.Hourglass True
.Execute "qrystyleappendstyle", dbFailOnError
.Execute "qrystylegary", dbFailOnError
End With

Exit_Command49_Click:
DoCmd.Hourglass False


Exit Sub

Err_Command49_Click:
MsgBox Err.Description
Resume Exit_Command49_Click

End Sub


1. What is the error message? And what is the error number, if that is
available?

2. Maybe you have set your Error Trapping option, on the General tab of the
VB Editor's Tools -> Options... dialog, to "Break on All Errors". If so,
set it back to "Break on Unhandled Errors".
 
H

Haggr1 via AccessMonster.com

Both queries are append


When runing the code "error message" "Changes not successful... duplicate
values, primary key..." I can't force thru this. If I run the 2 queries
independently here are the 3 messages.

1 About to run append query...
2 About to append (345) rows
3 Can't append all ... only appended 280 rows.

which Click OK and all is fine

I have an older version of my program where that code works w/o messages. It
only changed after I ran "Debug" "Complie"

Could it have change the code it the append queries. The query (qrystylegary)
does call on a module.

Dirk said:
Below is the code used to run 2 queries w/o error messages. But after
running "debug" a few months ago this code quit working: returning an
[quoted text clipped - 23 lines]

1. What is the error message? And what is the error number, if that is
available?

2. Maybe you have set your Error Trapping option, on the General tab of the
VB Editor's Tools -> Options... dialog, to "Break on All Errors". If so,
set it back to "Break on Unhandled Errors".
 
H

Haggr1 via AccessMonster.com

Please help: see previous posts
Both queries are append

When runing the code "error message" "Changes not successful... duplicate
values, primary key..." I can't force thru this. If I run the 2 queries
independently here are the 3 messages.

1 About to run append query...
2 About to append (345) rows
3 Can't append all ... only appended 280 rows.

which Click OK and all is fine

I have an older version of my program where that code works w/o messages. It
only changed after I ran "Debug" "Complie"

Could it have change the code it the append queries. The query (qrystylegary)
does call on a module.
[quoted text clipped - 8 lines]
VB Editor's Tools -> Options... dialog, to "Break on All Errors". If so,
set it back to "Break on Unhandled Errors".
 
J

John W. Vinson

Please help: see previous posts
Both queries are append

When runing the code "error message" "Changes not successful... duplicate
values, primary key..." I can't force thru this. If I run the 2 queries
independently here are the 3 messages.

1 About to run append query...
2 About to append (345) rows
3 Can't append all ... only appended 280 rows.

which Click OK and all is fine

I have an older version of my program where that code works w/o messages. It
only changed after I ran "Debug" "Complie"

Could it have change the code it the append queries. The query (qrystylegary)
does call on a module.
Below is the code used to run 2 queries w/o error messages. But after
running "debug" a few months ago this code quit working: returning an
[quoted text clipped - 8 lines]
VB Editor's Tools -> Options... dialog, to "Break on All Errors". If so,
set it back to "Break on Unhandled Errors".

Haggr, now could anyone possibly debug your code? You have not shown your
query; you have not shown your code; you have not even posted a comprehensible
question ("code it the append queries"...???)

Please step back a bit, and start a new thread posting your code, some
description of the tables and their relationships, and the SQL view of your
query. A description of what you're trying to accomplish would be helpful as
well.
 

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