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

report linked to current form

Status
Not open for further replies.

tizwaz

Technical User
Aug 8, 2002
437
GB
I want to be able to click a button to launch a report based on the details of the person to whom the current record in a form applies. Does anyone know how I go about this?

 
Hopefully in the form there is a primary key for the user, such as a user ID. The button then becomes something like

DoCmd.OpenReport "Reportname", acViewPreview, WhereCondition := "UserID='" & Me!UserID & "'"

to open in print preview mode.

John
 
Thanks - Yes there is a primary key called StaffID. I'll have a go - thanks for the help
 
When you modify the query that your report is based on. Use a parameter(specified in the criteria section of the query) you want to use are based on the values you have diplayed in your form.
Example:
This one is used to pass in date parameters for recrods that fall between to seperate dates:

Between ([Forms]![mynewfrm]![txtStartDate]) And ([Forms]![mynewfrm]![txtEndRptDate])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top