Doug, Thanks that worked partially, however I have a question. Inorder to
open that report, a criterial has to be met, I have to enter a begining
and
ending date, and select a customer criteria from a listbox. With the code
you provided, it will print all the records in my database instead of only
those I selected in the criteria...
Also I was not sure if I should put the code you gave me after the end iF
statement for for to work for alll the criteria...
This is how my Preview button code looks like... (Same code is in my print
button but with acnormal instead of acpreview)
Private Sub Preview_Click()
Dim strDocName As String
Dim intPage As Integer
strDocName = "rptInvoice"
If Me.CustType.Column(0) = "<All Customers >" Then
DoCmd.OpenReport strDocName, acViewPreview
ElseIf Me.CustType.Column(0) = "<Mid West Customers>" Then
DoCmd.OpenReport strDocName, acViewPreview, , "[PrintBTime] is
null And [LoanType] ='" & "MWC" & "'"
ElseIf Me.CustType.Column(0) = "<Central Customers>" Then
DoCmd.OpenReport strDocName, acViewPreview, , "[printBTime]is
null And [LoanType]='" & "CC" & "'"
For intPage = Application.Reports(strDocName).Pages To 1 Step -1
DoCmd.PrintOut acPages, intPage, intPage
Next intPage
DoCmd.Close acReport, strDocName
End if
Douglas J. Steele said:
Sorry, forgot to declare it, didn't I?
Dim intPage As Integer