Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Variable or With Block Variable not set (MACRO)

Status
Not open for further replies.

ITGUY99

MIS
Jan 17, 2002
31
US
OK, Simple Macro

OpenReport (Opens the report I want Printed)
PrintOut (Print out the Report)

EVERY time I run the macro, I get the message "Object Variable or With Block Variable not set" when it runs the PrintOut section of the macro.

The reports prints out but I am attempting to get the marco to run with no errors. Any Ideas

Thanks in Advance.
 
Hi

Is there any VBA code in the OnOPen Event of the Report?

Why use Macros, you have more control with VBA Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks for your fast response.

Unfortunately, I am sorry to say that I am one of the people that knows a decent amount of access but little VB. I am working to correct this problem.

Fortunately, I am happy to report that I fixed the problem. When I used the OpenReport command I used Print and the view. I changed it to Print Preview and it seemed to work great.

I did a search on that error and it seems to be a VB error. But since I have little-to-no VB in my cheesy DB, I thought that I should post it.

Thanks again for your response.
 
A good way to start the move toward learning VBA is to convert all of your macros to code (there's a menu selection that does this). Then, when you need to make changes, you'll have to learn. It's a far better life, here on the VBA side of the fence. Come on over and have some fun.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Believe me, I know how important it is to jump the fence and I will work on it.

Jeremy
I tried your idea to convert the Macro to VB and I get that error “Object Variable or With Block Variable not set".

Right now everyone really likes the way that the DB works but in my free time I and going to sit with a VB book and redo the DB.

Thanks for your help.
 
Cool. It sounds like there is SOME code in your database. Open up whatever code there is (or just a blank module will do) and compile the whole database. That will probably track down the problem for you.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top