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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Button - for One Page of Report 1

Status
Not open for further replies.

dragonmustard

Technical User
Apr 26, 2001
8
US
How can I print one page of a Columnar Report without Printing the entire multi-page Report? Ideally, I would like to have a command button on the form which prints out a single page report "Service Form for One Customer." The service rep. completing the Service Form...could print the current form he just completed.

I have written a macro which prints the report, but I have to manually go back to the Query and adjust the criteria (tracking # field) to acquire the desired page form.

In my macro, I wrote:
Open Report
Print Out (with print range set to--Selection; page from: 1 and page to: 1)
Stop Macro
Quit

I am not sure if I am on the right track or looking in the wrong directon. Any suggestions would be highly appreciated.

DM
 
Hi DM

I had the same problem a while back use this code as an event procedure when the button is clicked.

Private Sub btnPrintForm_Click() 'Print Preview Button Code
On Error GoTo Err_btnPrintForm_Click
'This code opens the report defined in the string
'stDocName limiting the report selection to the
'form details that are being displayed "RepairID"
'This prevents all report pages being printed.

Dim stDocName As String 'declare string name

stDocName = "Repair Details" 'insert report name into defined string

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 DoCmd.OpenReport stDocName, Preview, , "[RepairID] = Forms![Repair Details]![RepairID]"

Exit_btnPrintForm_Click:
Exit Sub

Err_btnPrintForm_Click:
MsgBox Err.Description
Resume Exit_btnPrintForm_Click

End Sub

Hope this helps

Grant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top