Some reports will open up, but not others?

RSW

Registered User.
Local time
Today, 13:49
Joined
May 9, 2006
Messages
178
I have a list box that displays reports that are supposed to open up when clicked. Some of the reports are opening up, some are not, and I can't seem to figure out why.

The relevant part of my VBA is like so:

Code:
    MsgBox (Me![ReportList])
    DoCmd.OpenReport Me![ReportList], acPreview
    MsgBox ("won't see this")

So when I click the Reorder Report (one of those that's not working), I get a ReorderRpt message. That is exactly what the report is called.

Then...nothing happens. I do not get the "won't see this" message. The code doesn't get there.

If I substitute:

Code:
    DoCmd.OpenReport Me!ReorderRpt, acPreview

in the VBA, I still don't get my report or the "won't see this" message, but I do get a "Previewing report was cancelled!" message box. I have no idea where this is coming from...I searched the whole project's VBA and it was not found.

If I use the wizard to add a button to open the ReorderRpt report...it works perfectly fine.

Does anyone have any ideas why this report will not generate in the above fashion?

Thanks in advance!
 
Are you sure that the listbox bound column is on the report name and not something else like a description?
 
Are you sure that the listbox bound column is on the report name and not something else like a description?

Yep, the listbox is set up correctly. I haven't found a way to open this particular report at *all* in VBA, but it works perfectly fine when clicking on it in the Reports list on the left hand side, or setting up a button on a form for it.
 
Yep, the listbox is set up correctly. I haven't found a way to open this particular report at *all* in VBA, but it works perfectly fine when clicking on it in the Reports list on the left hand side, or setting up a button on a form for it.

What's the name of the report?

If it has spaces or special characters or is an Access Reserved Word you would probably need to set up your code like this:

Code:
DoCmd.OpenReport [COLOR=red]"[" [/COLOR]& Me.ReportList & [COLOR=red]"]"[/COLOR], acPreview
And I prefer to use the dot when referring to controls.
 
The name of the report is ReorderRpt. No funny characters or reserved words as far as I can tell.
 
try:
DoCmd.OpenReport Me.ReportList.column(0), acPreview

or what ever columns the report name is ine
 

Users who are viewing this thread

Back
Top Bottom