Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

On error resume next doesn't resume next

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ragtopcaddy - 20 Mar 2008 19:07 GMT
Here's my code:

On Error Resume Next
rs.Close
Set rs = Nothing
wkBk.Close
Set wkBk = Nothing
xlObj.Quit
Set xlObj = Nothing
End Function

Most of the time, the workbook will be closed. My intention is that, if the
wkbk is already closed and/or set to nothing, the next line of code should
execute. It doesn't. Instead I get Run-time error '91' - "Object variable or
With block variable not set" and the code stops at "wkBk.Close". Where am I
going wrong?

Signature

Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Klatuu - 20 Mar 2008 20:32 GMT
In the VB editor:
Tools, Options, General Tab
Be sure Break on unhandled errors is selected
Signature

Dave Hargis, Microsoft Access MVP

> Here's my code:
>
[quoted text clipped - 12 lines]
> With block variable not set" and the code stops at "wkBk.Close". Where am I
> going wrong?
ragtopcaddy - 24 Mar 2008 13:40 GMT
Klatuu,

Thanks for the reply. It is already selected. It's puzzling that precisely
the behavior one is trying to avoid by using On Error Resume Next would occur.

Regards,

>In the VB editor:
>Tools, Options, General Tab
[quoted text clipped - 4 lines]
>> With block variable not set" and the code stops at "wkBk.Close". Where am I
>> going wrong?

Signature

Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.