Error Handling Problem

  • Thread starter Joker via AccessMonster.com
  • Start date
J

Joker via AccessMonster.com

Hello,

I have setup error handling in a module that runs a bunch of queries. For
one of them it connects to a database that is in a Microsoft workgroup of if
you try running the query while not signed into the work groups you get an
error. I have setup my error handling to catch that error but it seems to be
skipping it and still shows the error leaving my code open. Any thoughts?
Code below..

Private Sub Command5_Click()
On Error GoTo Err_AStoopidFreakinError2
DoCmd.SetWarnings False
'Runs all of the queries to get all the information setup (except the
remit date)
DoCmd.OpenQuery "qry_CompileImportDIL", acViewNormal
DoCmd.OpenQuery "qry_Payoffs", acViewNormal
DoCmd.OpenQuery "qry_FindCurrentRemits", acViewNormal
DoCmd.OpenQuery "qry_FindCurrentPayoffs", acViewNormal
DoCmd.OpenQuery "qry_CurrentRegister_WithPayoffs", acViewNormal
DoCmd.OpenQuery "qry_CompleteRegister(NoDueDates)", acViewNormal
'This query appends all the data worked out into "tbl_MAIN"
DoCmd.OpenQuery "qry_AppendToMain", acViewNormal
'Deletes all the make-tables so they can be replaced when the dB is run
next time
'DoCmd.DeleteObject acTable, "register_ImportErrors"
DoCmd.DeleteObject acTable, "tbl_CombinedInfo"
DoCmd.DeleteObject acTable, "tbl_CompleteRegister(NoDueDates)"
DoCmd.DeleteObject acTable, "tbl_CurrentRegister_WithPayoffs"
DoCmd.DeleteObject acTable, "tbl_payoffs"
DoCmd.DeleteObject acTable, "tbl_Payoffs_On_CurrentRegister"
DoCmd.DeleteObject acTable, "tbl_Registerxls"
DoCmd.DeleteObject acTable, "tbl_WirePayoffInfo"
'Runs all the queries to calculate the due date for the wires and puts it
into tbl_MainHolding
DoCmd.OpenQuery "qry_RunCodeInterim", acViewNormal
DoCmd.OpenQuery "qry_NotNullRemits", acViewNormal

DoCmd.OpenQuery "qry_RunCode", acViewNormal
DoCmd.OpenQuery "qry_EndResult2MainBS", acViewNormal
DoCmd.OpenQuery "qry_UpdateDtDiff_InMAINBS", acViewNormal
DoCmd.OpenQuery "qry_RunCodeDaily", acViewNormal
DoCmd.OpenQuery "qry_RunCodeTomorrow", acViewNormal
'This query appends all data from tbl_END_RESULT table to the archive dB
'Located at: S:\Iashare\Private-REMIC\Remittance Register\Remittance
Register dB\Back Up dB\Remittance Register Archived Data.mdb
DoCmd.OpenQuery "qry_Archive", acViewNormal
DoCmd.SetWarnings True

Exit_Here4:
Exit Sub

'Error Handler
Err_AStoopidFreakinError2:

Select Case Err.Number
Case 3033
MsgBox ("You must be logged into the Microsoft User Work Groups to
run this!" & Chr(13) & "The icon looks like a fox. Contact the support team
if you need to request access")
MsgBox ("You have recieved an error" & Err.numbernumber & Err.
Description & Chr(13) & "Please finish running the database buttons," & Chr
(13) & " then redo it to make sure you recieve proper output." & Chr(13) &
"If you still are having problems contact your support team.")
Resume Exit_Here4
Case 999
Resume Exit_Here4
Case Else

MsgBox ("You have recieved an error" & Err.numbernumber & Err.Description &
Chr(13) & "Please finish running the database buttons," & Chr(13) & " then
redo it to make sure you recieve proper output." & Chr(13) & "If you still
are having problems contact your support team.")
Resume Exit_Here4
End Select

End Sub
 
D

Dirk Goldgar

In
Joker via AccessMonster.com said:
Hello,

I have setup error handling in a module that runs a bunch of queries.
For one of them it connects to a database that is in a Microsoft
workgroup of if you try running the query while not signed into the
work groups you get an error. I have setup my error handling to
catch that error but it seems to be skipping it and still shows the
error leaving my code open. Any thoughts?

Is it possible that you have the Error Trapping option in the VB
Editor's Tools -> Options... dialog (General tab) set to "Break on All
Errors"? I expect you want it to be set to "Break on Unhandled Errors".
 

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

Similar Threads

Error 20 Resume without Error 2
Object required error 4
Import File 1
OutPutTo Issues - HELP 1
Create 1 VB code in acces to run Queries then run excel macro 0
error 3078: 5
Error 2391 5
Run Time Error #3021 1

Top