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

Need Report for Single Record

Status
Not open for further replies.

sandingdude

IS-IT--Management
Jun 26, 2002
109
US
I have a report for people donating to our charity. It lists all the people that have donated between a certain date. I have to create a thank you letter that states all the donations from a specific donor. I have a form with the persons name, address, and all donation info. I need to put a button that runs a report (aka thank you letter) for that record I am viewing at that given moment.

Thanks
 
You can add a command button using the wizard. When the wizard has finished, it will have created the code to open the report in preview mode. Open the code module and modify it like:
Code:
Dim strWhere as String
strWhere = "[DonorID]=" & Me.txtDonorID
DoCmd.OpenReport "rptThankYou", acPreview, , strWhere
This assumes you have a numeric primary key in the donor table named [DonorID]. Modify the code to fit your report, field, and control names.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Duanne

I've been trying what you've said but when I run the report I get MS Visual Basic Compile Error which says "Method or data member not found".

Any ideas?

Thanks
 
You must substitute your field and control names to match your situation. What value on your form matches a field in your report's record source? What data type is the field?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top