Solved

Process won't run second time in ACCESS 2003

Posted on 2013-06-06
4
439 Views
Last Modified: 2013-06-07
I have a form in an ACCESS 2003 database from which the user can select days to create am Excel 2010 workbook.  They can select, say, all the Month of May, run the process to export the data to Excel.  However, if they select another month, say March, then run it again, the process fails.  It throws Error Number 91, Object variable or With blcok variable not set.  This is a show stopper and I have no idea what to look for.

Sandra
0
Comment
Question by:ssmith94015
4 Comments
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 100 total points
ID: 39227534
How are you creating the Excel Workbook?

It would help to see the VBA you are using.

If you are using Automation you might have an issue with Excel not getting terminated properly.
0
 
LVL 22

Assisted Solution

by:Kelvin Sparks
Kelvin Sparks earned 100 total points
ID: 39227546
Also check what object you shut at the end that may have been opened prior to the first session. Probably identified by .Quit

Kelvin
0
 
LVL 20

Accepted Solution

by:
clarkscott earned 300 total points
ID: 39229802
"Object variable or With blcok variable not set" means you are trying to access an object that is "no longer there".  You may want to close your Excel app completely when finished, then run he whole thing again when you want to do another.
Put all you Excel code (dims, open, close, etc.) in a function and pass the necessary info to the function each time.
Scott C
0
 

Author Closing Comment

by:ssmith94015
ID: 39230613
Yes, that was it.  All suggestions contributed to the solution.  Thank you as this was a real problem.

Sandra
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now