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!

Prieview a report

Status
Not open for further replies.

rickyoswald

Programmer
Jun 12, 2004
59
GB
I wish to simply view a report I have made in access. Thus far I have:

Dim AccessApp As Access.Application

--------------------------------------------

Set AccessApp = New Access.Application

AccessApp.OpenCurrentDatabase (App.Path & "\AddressDatabase.mdb")
AccessApp.DoCmd.OpenReport "rptContacts"
AccessApp.Visible = True

For me this prompted a save of an MDI file which I saved (as default), then it opened the report in some wierd file viewer. When my friend used the same code it just printed the report off. I do not have a printer, I think .mdi file must be a print prieview file (confusingly named the same as an mdi form).

The code I had previously worked fine with Access97 databases but when I tried to run it with my Access2003 database it would open then close straight away without giving any errors.
 
I'm only use to Access97, but when you open a report using the OpenReport method of DoCmd the default is to print the report to the default printer (or to a specific printer if the report was saved in design mode with a specific printer selected).

Try:

DoCmd.OpenReport "xyx", acViewPreview

This will force it to be print previewed.

[shadeshappy] Cruising the Information Superhighway
(your mileage may vary)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top