Object Required

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

Guest

Hi

I have a button on a form that previews several reports which contain word
inclusions.

Each time the button is pressed before the report opens i get a small box
which says "Object Required" and has an okay button. Once the okay button is
pressed the report opens correctly but it is an inconvinience to the users.

Suprisingly this problem only began to occur after various updates were run
from windows xp and 2000.

Thanks

Gillian
 
gdonald20 said:
Hi

I have a button on a form that previews several reports which contain word
inclusions.

Each time the button is pressed before the report opens i get a small box
which says "Object Required" and has an okay button. Once the okay button
is
pressed the report opens correctly but it is an inconvinience to the
users.

Suprisingly this problem only began to occur after various updates were
run
from windows xp and 2000.

Thanks

Gillian

What's the code behind the button?

Keith.
www.keithwilby.com
 
gdonald20 said:
Hi

It's just standard docmd.openreport " ", acpreview

Strange. Do all of the reports run OK stand-alone (ie opened by hand from
the db window)?

Keith.
 
Hi

No if i open any of the reports from the database window i get the object
required thing.

I tried putting code on the on open of the report to put the echo and
setwarnings off but that doesn't work.

I'm completely at a loss as this problem did not occur before.

Gillian
 
gdonald20 said:
Hi

No if i open any of the reports from the database window i get the object
required thing.

I tried putting code on the on open of the report to put the echo and
setwarnings off but that doesn't work.

I'm completely at a loss as this problem did not occur before.

Do your reports' queries run without error? Also, is there any code in the
reports that might be suspect? Do you have any unspecified
database/recordset declarations - by that I mean statements such as Dim db
As Database?

Other options to try (BACK UP YOUR FILE FIRST):

Compact/Repair
Decompile/Compile
Import objects into a new db file.

Keith.
 
Hi

I have already tried rebuilding and compacting and repairing.

The only code i call in the report references the following module

Function Print_Preview_Toolbar_On()

'Switches on the Print Preview Toolbar and also the Menu Bar to allow
'printing to a different printer and particularly to allow the user
'to close the print preview screen without exiting the database.

DoCmd.ShowToolbar "Menu Bar", acToolbarYes
DoCmd.ShowToolbar "Print Preview", acToolbarYes

End Function

when i comment out the line of code

Print_Preview_Toolbar_On = true in the on open event of the report the error
appears to disappear.

Do you have any idea why switching the print preview toolbar on and off
would cause this problem?

Thanks

Gillian
 
when i comment out the line of code

Print_Preview_Toolbar_On = true in the on open event of the report the
error
appears to disappear.

Do you have any idea why switching the print preview toolbar on and off
would cause this problem?

Haven't a clue, sorry. An alternative to the code would be to specify which
menus and toolbars to use in the reports' properties box.

Keith.
 
Hi

I'm not sure what you mean by specific them in the report, where would i do
this?

Thanks

Gillian
 
gdonald20 said:
Hi

I'm not sure what you mean by specific them in the report, where would i
do
this?

Open your report in design view. From the "View" menu, select "Properties".
This should show/hide a box with 5 tabs. Select the "other" tab - use "Menu
bar", "Toolbar" etc to specify which you'd like the report to use.

Regards,
Keith.
 
Stupid question.

Is there a report name between the quote marks? Is the string the name of
an existing report?

Docmd.OpenReport "Name of Report"
 
Hi

Yes there is a report between the quote and it's an existing report.

When you open the reports you get the object required error but once you
press okay the report opens perfectly.

Gillian
 
Back
Top