Solved

Process won't run second time in ACCESS 2003

Posted on 2013-06-06
4
450 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

786 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