Limit how many pages of a report will print from "preview mode"

G

Guest

I have an application where the user will need to open a report in "preview
mode" and decide from there whether to print the report or only view it and
close it. If the user decides to print the report while it is opened in the
"preview mode", is there a way I can limit the number of pages that will
print from the report?
Only the first page of the report will need to be printed should the user
decide to print it.

Thanks,
RC
 
G

Guest

I do not know if this will help you but. This is directly from the visual
basic help files for access for finding how many pages your report is.

Dim intTotalPages As Integer
Dim strMsg As String

intTotalPages = Me.Pages
strMsg = "This report contains " & intTotalPages & "
pages."
MsgBox strMsg
 
G

Guest

Thanks Eric. I kept experimenting around and came up with something that
works, yet it's probably a clunky and cumbersome way, considering my limited
experience with this. Anyhow, here goes; I created a command button to open
the report in "print preview", and then went in and "edited" code as follows:

Private Sub Cmd_Open_DISTRICT_FTE_Report_Click()
On Error GoTo Err_Cmd_Open_DISTRICT_FTE_Report_Click

Dim stDocName As String
Dim Yes As String
Dim No As String

stDocName = "DISTRICT_FTEs"
DoCmd.ShowToolbar "Print Preview", acToolbarNo
DoCmd.OpenReport stDocName, acPreview
Dim Message, Title, Default, Myvalue
Message = "Enter Yes To Print or Enter No to Continue Viewing"
Title = "Print Option"
Default = "No"
Myvalue = InputBox(Message, Title, Default, 100, 100)
If Myvalue = "Yes" Then
DoCmd.PrintOut acPages, 1, 1, acHigh
End If

Exit_Cmd_Open_DISTRICT_FTE_Report_Click:
Exit Sub

Err_Cmd_Open_DISTRICT_FTE_Report_Click:
MsgBox Err.Description
Resume Exit_Cmd_Open_DISTRICT_FTE_Report_Click

End Sub

Although this worked, I'd still would welcome any suggestions that would
make it better.

Thanks Again,
RC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top