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

Report button on form 1

Status
Not open for further replies.

realflava

Technical User
Apr 11, 2004
16
0
0
DE
I'm creating a database which allows me to enter details of my visit to a site, and the dbase creates a report with all the details I have inputted.

I have created a report with all the relevant fields layed out etc.

When executing the report it only produces report for the first record of the database. I have created a form to input the info, where I would like to place a Report button, so it produces a report for the record Ihave selected and not just the first record. Do I make sense??

thanks
 
You can use the WHERE clause parameter in the OpenReport command:

Command Syntax:
Code:
DoCmd.OpenReport reportname[, view][, filtername][, [red]wherecondition[/red]]

Example:
Code:
DoCmd.OpenReport "[I]rptYourReport[/I]", acNormal, , "[[I]IDFieldName[/I]] = FORMS![[I]yourformname[/I]]![[I]IDfieldname[/I]]"

This will select the record on your form and only print that record. You must create this WHERE condition statement so that the unique identifier is used from the form to match to the unique identifier field/s. This could be a compound condition comparing two controls to two fields or more.

Post back if you have any questions.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
excellent Bob, thanks a bunch for that! I tried the one they provide in Access Help - I went around in circles! The one you gave me was spot on.. thanks again ;)
 
Glad that I could help. Good luck.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top