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

Report on current Record

Status
Not open for further replies.

stacyemma

IS-IT--Management
Jan 23, 2003
8
GB
I have seen many posts on this but after trying all the suggestions I am still finding it impossible to do the above.
I have a report which it accessed through a button on my main form. However when the report is run it reports on all records where I only want it to produce a report on the current record.
I have tried playing with the criteria in the query which is associated with the record source of the report. Also I have tried some different coding which has been posted previously.
Nothing seems to work. Any help would be much appriciated!
 
You should have a primary key in your table. Let's say your field is EmployeeID and it is numeric. View your form in design view and view the event properties of you command button. Open the On Click event and add a where clause to the Docmd.OpenReport

Dim strWhere as String
strWhere = "[EmployeeID]=" & Me.EmployeeID
DoCmd.OpenReport "rptYours",acViewPreview , , strWhere
Your code will vary based on your object names.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top