?
Solved

Process won't run second time in ACCESS 2003

Posted on 2013-06-06
4
Medium Priority
?
485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 400 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 400 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 1200 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

770 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