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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REPORT DOESN'T DISPLAY FIRST TIME

Status
Not open for further replies.

franksirvent

Programmer
Mar 8, 2002
358
GB
Hi

Is there a way of forcing a report to display/preview in code?
I have used docmd.maximize etc etc and nothing works.

This is what happens:

I have a report (preview mode) which doesn't display the FIRST TIME time it is open/displayed.

Any other time after that it is opened previews perfectly.

When I try to preview the first time, the Access application seems to 'dissapear' (minimizes itself/hides), and all I get is the Access ICON on the START bar of Windows.

In order to view the report (first time) I have to click on the Access ICON on the Windows Start Bar and then I can see it.

From then onwards everything works perfect.

At first I thought there was something on my code which made this happen BUT why does it only happens the first time?

Your comments/suggestions are appreciated
thanks in advance
 
Hi,

DoCmd.OpenReport "YourReport", acViewPreview ?

Or, what I sometimes do is on the command button event prior to opening the report I minimize the form:

DoCmd.minimize

Then on the report's On Close event, re-open the form.

Hope that helps.
 
thanks for your comments pdldavis

I open the form with the following code:

DoCmd.OpenReport "Print Standard", acViewPreview, "", "[QuoteID]=[Forms]![Quotes]![QuoteID]"

So it is pretty much the same way as you mention, only that it opens a specific record.

I do have docmd.minimize same as you mention.

Like I said, everything looks fine, and as a matter of fact it works fine the 2nd, 3rd, 4th time etc it is ONLY the very first time that it doesn't, this is what's got me puzzled...

 
Hi, don't think I can add much more to that other than are you sure you need the double quotes after ACviewpreview?
 
thanks for replying
No, I don't think I need them, I was just testing different things, and that was the last try.
It still works anyway BUT it doesn't fix my problem...unfortun ately...
 
Hi, after thinking about that some more, could it be that you are trying to print a record that has not been saved or something along those lines?

You could try: DoCmd.RunCommand acCmdSaveRecord
prior to the print command.

That is odd. Maybe someone else has a better suggestion.

 
thanks for your idea...
doesn't work

me neither, I have never seen it and it is illogical.
I have gone several times line by line through the code without any success.

The worse thing is that it only happens the first time, after it shows perfectly.
If it was always doing it at least it would be easy to find the problem...

thanks anyway.
 
Sorry I couldn't be of more help. I have the opposite problem. I'm pulling a calculated value in a report footer to use as a maximum value for a graph. This works perfectly the first time. All subsequent times I get a garbage number. Go figure...........
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top