Print preview command button problem

phatus

Registered User.
Local time
Today, 09:15
Joined
Nov 10, 2010
Messages
100
i have a button in my form which named Printpreview, the function on this is to printpreview the current record in the form...

i trid this code but its not working
my form name is frmrecords

Code:
Private Sub Command112_Click()
DoCmd.RunCommand acCmdPrintPreview
End Sub
 
Use OpenReport instead.
DoCmd.OpenReport "ReportName", acViewPreview
If you want to open the report and show only some of the records, use the WhereCondition argument. vba Help on OpenReport explains how to do it.

Replace ReportName with the name of the report you want to open.
 
i already think of that but i design my form printable in a legal paper.. i already have the button to print the form... i just awnt to add the print preview button in my form...

thank you for helping...
 
The code I have written goes on the click event of the print preview button. It opens the report in print preview mode so the user can view the report before they print.
You need to replace your code
DoCmd.RunCommand acCmdPrintPreview
- (that doesn't work) with the code I posted to open the report in print preview.
 
DoCmd.RunCommand acCmdPrintPreview
- (that doesn't work) with the code I posted to open the report in print preview.

it really dont work.. you see i hide the toolbar by making a vb code like
DoCmd.ShowToolbar "ribbon", acToolbarNo

so all the ribbon is now hide... thats why i need to put the print preview button in the FORM...
can you help me regarding this? prntpreview in the form not in report.. i tried to search in google but cant find enough info...
i need the vb code in the button...

thanks a lot...
 
i already think of that but i design my form printable in a legal paper.. i already have the button to print the form... i just awnt to add the print preview button in my form...

thank you for helping...

You need to realize something. Forms are not optimized for printing. So the features you have available to you to use for those are VERY LIMITED. Reports are designed for printing so you have way more options for them. That is why we recommend designing a report that looks like your form so that when you print it will look and act like you want it to. This has ALWAYS been the case with Access.
 

Users who are viewing this thread

Back
Top Bottom