how to print single report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am setting up a very basic database.
Customer table
Customer entry form
proposal report
envelopes report
envoice report

Customer entry is working fine. When I view or print a report, all records
are displayed or printed. I used the comand button wizard to set up the
commands.
 
You should open the Form contining the Command Button that runs the Report
in Design View. Right-click that button, and in the Events tab of
Properties, look at the Click event. You'll find a DoCmd.OpenReport
statement -- put the cursor on that statement and press F1. The
"WhereCondition" argument is the key to doing what you want.

I'd suggest putting a ComboBox on the Form so the user can select which
particular record is to be reported -- the wizard will help you do this.

As you didn't indicate details, I can't be more specific, but if you'll post
back with (1) the DoCmd.OpenReport statement copied from your application,
(2) rename the Combo Box to the name of the Field being selected preceded by
"cbo" and (3) tell us what that name is, and the name of the Field in the
underlying table that determines which Record you want Reported, then I'd
suspect someone here can give you the exact code that you need to add to the
Click event.

Larry Linson
Microsoft Access MVP
 
Thank you for the reply Larry,

"ID" is the key in my customers table. I have 3 comand buttons which need
to be set up for current record only.
View Report, Print Report, and Print Envelope. Out of the 3 Print envelope
is the only one working correclty. Here are the cmd
VIEW REPORT
Dim stDocName As String
stDocName = "Residential Proposal"
DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=" & Me!ID

PRINT REPORT
Dim stDocName As String
stDocName = "Residential Proposal"
DoCmd.OpenReport stDocName, acViewNormal, , "[ID]=" & Me![ID]

the above comands give a message box Enter The Paramater Value. I can
enter any value to view or print the current record. Below is the cmd for
PRINT ENVELOPE. This cmd works properly. The only thing different is the
report.

Dim stDocName As String
stDocName = "Residential envelope"
DoCmd.OpenReport stDocName, acViewNormal, , "[ID]=" & Me![ID]

Thanks
Mike Castellanos
 
Back
Top