Using VBA to open reports in Access 2000, 97

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
73,431
Office Version
  1. 365
Platform
  1. Windows
I have written some VBA code my computer in Access 2002. Essentially, I am simply attempting to open a Report in Print Preview mode. This is my code:

DoCmd.OpenReport "rpt Rolodex", acViewPreview, "", "", acNormal

Someone using Access 2000 or Access 97 get errors when this code is run, and it highlights this line.

Does this command not work on earlier versions? Could someone tell me what code to use to open forms in Access 2000/97?

Thanks.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Your syntax looks ok, but try taking out the empty strings so that your code looks like:
Code:
DoCmd.OpenReport "rpt Rolodex", acViewPreview, , , acNormal
 
Upvote 0
Thanks for the reply. I just found the answer I need.

I actually got the original code by writing a Macro on 2002 to open the report, then did the utility to "Convert the Macro to Code".

I recreated it on the computer using Access 2000, and the argument very similar, except with one less argument:

DoCmd.OpenReport "rpt Actions", acPreview, "", ""

When I change it to this code, it works fine on both Access 2000 and Access 2002.

Forget any mention of Access 97. Access 97 won't even open a database made in Access 2002.
 
Upvote 0

Forum statistics

Threads
1,221,596
Messages
6,160,719
Members
451,666
Latest member
GCS1998

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top