Error 20 Resume without Error

K

Kirk P.

I've got this code

Sub ImportCSV()
On Error GoTo ImportCSV_Err

DoCmd.SetWarnings False
DoCmd.OpenQuery "qdelOPT_DT_GAAP_SUMMARY_1", acViewNormal, acEdit
DoCmd.TransferText acImportDelim, "OPT_DT_GAAP_SUMMARY_1 Import Spec", _
"tblOPT_DT_GAAP_SUMMARY_1", "\\oprdgv1\depart\Finance\" & _
"_Health Solutions Group\Allocations\OPT_DT_GAAP_SUMMARY_1.csv",
True, ""

DoCmd.OpenQuery "qdelNon_Optum_BU", acViewNormal, acEdit
DoCmd.OpenQuery "qdelTieOpEx", acViewNormal, acEdit
DoCmd.OpenQuery "qdelAllocExpense", acViewNormal, acEdit
DoCmd.OpenQuery "qappAllocExpense", acViewNormal, acEdit

If DCount("*", "qselIn_GL_no_ARule") <> 0 Then
MsgBox "There are " & DCount("*", "qselIn_GL_no_ARule") & " records"
& vbCrLf & _
" with no allocation rules assigned!", vbInformation, "Note"
DoCmd.OpenForm "frmNoARule", acNormal, "", "", acReadOnly, acNormal
Resume ImportCSV_Exit
Else
DoCmd.OpenQuery "qupdARule", acViewNormal, acEdit
End If
MsgBox "File imported!", vbInformation, "Import Status"

ImportCSV_Exit:
DoCmd.SetWarnings True
Exit Function

ImportCSV_Err:
MsgBox "Error: " & Err.Number & " " & Err.Description
Resume ImportCSV_Exit

End Sub

It works well, with the exception of an "error 20 Resume with error" message
box that pops right after frmNoARule opens. How can I prevent this message
box from appearing?
 
A

Analyst72

This is the error you get when you use a resume statement outside an
error-handling routine. Replace Resume ImportCSV_Exit with GoTo ImportCSV_Exit
 
K

Kirk P.

OK, thanks!

Analyst72 said:
This is the error you get when you use a resume statement outside an
error-handling routine. Replace Resume ImportCSV_Exit with GoTo ImportCSV_Exit
 

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


Top