Report open without data

adams.bria

Registered User.
Local time
Today, 11:34
Joined
Apr 28, 2010
Messages
41
Opening my report from form:
Code:
DoCmd.OpenReport "rptcurrent_openings", acViewReport, , , acDialog

Then on the report itself:

Code:
Private Sub Report_Load()

DoCmd.MoveSize 28000
DoCmd.Maximize

End Sub

When the report loads, no data is there. If I scroll over, then everything appears. Otherwise it is just a grey screen. I wasn't having a problem when I was using acviewpreview, however I added a button to go to another report on rptcurrent_openings. Thus print preview would not work. Any help?
 
Not sure, been a while since I've messed around with moving and sizing access reports in code but off the top of my head you could try adding:
Code:
me.refresh
after the code in the reports load procedure
Also is there any reason that the report has to be opened in dialog mode rather than acwindownormal? It's pretty unusual for for something needing to be done on a report before going back to the form initiating - this may be preventing the preview code from being executed
 
1. Is this a Pop-Up report?
2. You haven't specified what parameter 28000 is for.
3. The Load event is too early to resize the report. Run it after the OpenReport command.
 
Rank_Am:

It seems that me.refresh does not work in 2010 like it had in previous versions.
It needs to be dialog because I have it setup to open on the users 2nd monitor. As they still need to reference the form while evaluating the report that opens.

vbaInet:

Yes is it a pop-up report. My understanding is that using movesize, 28000 specifies the location it is being moved to. Haven't had an issue with that.

And I am not sure I am following what you are saying on point 3. The openreport command is even earlier than the load event. So to say that load event is too early performing it after open report would be even earlier. Maybe I'm just not understanding what you are saying.
 
I think vbaInet means to put your resize code after your OpenReport code like this:

Code:
DoCmd.OpenReport "rptcurrent_openings", acViewReport, , , acDialog
[COLOR="Red"]DoCmd.MoveSize 28000
DoCmd.Maximize[/COLOR]

Basically resize after the form has been completely opened. Note that the code in red is not correct, I believe you have to a do a full reference to a the report to call the MoveSize/Maximize methods. This is just to give you an idea of what I think he meant.
 
It seems the do.cmd maximize is actually the culprit here. I tried a couple different things, but using the same original codes, I took out maximize, and it run fine.

I moved docmd.maximize to the on click event. It created a fragmented report. http://imgur.com/oq9Z0


Harmankardon:
I do not know how to reference the form from the my click event. Wouldn't the next line of code wait until I closed the report to run? Or would all three lines run once I click? Any help would be greatly appreciated.
 
I have seen DoCmd.MoveSize fail before when put in the Load event. Sometimes it requires a timer and sometimes putting it after the OpenReport command does the job. If putting it after the OpenReport command doesn't work then you might need a timer.

However, you do realise that the parameter you've put that number is to move it to the right?
 
It seems the do.cmd maximize is actually the culprit here. I tried a couple different things, but using the same original codes, I took out maximize, and it run fine.

I moved docmd.maximize to the on click event. It created a fragmented report. http://imgur.com/oq9Z0


Harmankardon:
I do not know how to reference the form from the my click event. Wouldn't the next line of code wait until I closed the report to run? Or would all three lines run once I click? Any help would be greatly appreciated.

You're right, I forgot about the acDialog part which stops anymore code in the OnClick from running until the report is closed.

So if you leave out the DoCmd.Maximize line from the Load event of the report it works fine?
 
The funny think is that the Open event comes BEFORE the load event. So it should not fail on Load. But also, versions of Access prior to 2007 ONLY had the Open event as they didn't have a Load event for the report.
 
It seems the do.cmd maximize is actually the culprit here. I tried a couple different things, but using the same original codes, I took out maximize, and it run fine.
The obvious culprit. Timings...
 
Yes I realize the command moves it to the right. Everything is fine and dandy in that world. I've taken the maximize out, and the code runs fine.

I'm thinking the issue is using the maximize docmd on an acDialog. Does anyone have experience with that working? I've put the maximize on everything from a timer to click, all with the same result (pic above).
 
This is how you should do it:

1. Open report
2. Move it - Load event
3. Maximize it - Load event

If step 3 is still interferring, put it after the OpenReport command but leave the Move command in the Load event.

If you're still not having joy, use the timer to Maximize it.
 
vba:
Your 1,2,3 is how I originally had it. Got the broken report

Putting maximize on the openreport command doesn't work, as when you open in acDialog, the next line of code does not run until the dialog box is closed

Using a timer results in the same broken report image above.
 
Can you try the original 1, 2, 3 approach without the acDialog parameter just to see if that is causing the Maximize to fail?
 
Thinking about it, what's the point of moving it if you're going to end up maximizing it?
 
Harmankardon:

I thought of this, but I can't see what else I would put it as that would maximize? acHidden, acIcon, & acWindowNormal all just open as a 'tab'. Thus when I use them, they do open even with the maximize command, but it isn't actually moving or maximizing anything, as it is just a tab in my already open Access.
 
I've tried a few, 10k, 5, 50k... It opens in dialog fine, then when the timer fires it gives me that broken report. I've put the maximize on the click event, focus, just about everything; all to no avail.
 

Users who are viewing this thread

Back
Top Bottom