Won't acknowledge "OpenReport" command...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi -

I have a weird problem I've never seen before and was wondering if anyone
had any ideas. I have a simple button on a form that will allow printing the
data to a report using htese two commands:

stDocName = "Report - Contacts"
DoCmd.OpenReport stDocName ', acPreview

For some reason it's not executing the "OpenReport" command. I set the
Debugger on and step through the code and get no errors when I pass the
command.


Thanks a lot for any ideas!

Dan
 
Dan,

Check your printer, make sure you have a default printer set up
and that it is working.

md
 
Hi - the printer's working fine. I can print several other reports without a
problem. In fact, I can print the suspect report from another section of the
program without a problem. That's strange because the report content isn't
dependent on any code prior to executing the OpenReport command. The
report's own Open event doesn't even trigger, so it's not even getting that
far.

I forgot to mention, it's in Access 2002.

Dan
 
Hi -

I have a weird problem I've never seen before and was wondering if anyone
had any ideas. I have a simple button on a form that will allow printing the
data to a report using htese two commands:

stDocName = "Report - Contacts"
DoCmd.OpenReport stDocName ', acPreview

For some reason it's not executing the "OpenReport" command. I set the
Debugger on and step through the code and get no errors when I pass the
command.

Thanks a lot for any ideas!

Dan

If you code it this way, does it work?

DoCmd.OpenReport "Report - Contacts", acViewPreview
 
Hi -

I have a weird problem I've never seen before and was wondering if anyone
had any ideas. I have a simple button on a form that will allow printing the
data to a report using htese two commands:

stDocName = "Report - Contacts"
DoCmd.OpenReport stDocName ', acPreview

For some reason it's not executing the "OpenReport" command. I set the
Debugger on and step through the code and get no errors when I pass the
command.

If your OpenReport has a literal single quote character, it is clearly
invalid. I wonder if you've inadvertantly left SetWarnings False at
some point! Try removing the ' from the line.

Try opening the VBA editor and select Debug... Compile <my database>.
This error (and possibly other errors) will show up. Fix them.


John W. Vinson[MVP]
 
Nope, that doesn't do it either. I just mentioned in a previous post, I can
call the report from a different area of the program and it works fine. The
report content isn't dependent on any coding prior to the OpenReport command.
The Open event for the report isn't triggered so it's not even getting that
far. I can see the little small dialogue box for a split second that occurs
when you print something, but that's about all it does.
 
Not sure what you mean by "literal single quote character", but I've always
assumed Access ignores ever anything after a single quote, when used for
commenting code. I will try removing the single quote anyhow. I've had many
problems get cured by doing fixes like this for reasons I never understood,
and this may be one of those times!

Thanks - I really appreciate your ideas.

I won't be able to try that out till I get home from work later, but will
try it first thing.

Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top