Problems printing record from command button (1 Viewer)

MSUKevin

Registered User.
Local time
Today, 10:07
Joined
May 16, 2001
Messages
75
I have a form which calculates sales. At the end of this form I have a command button which I want to use to print out a reciept of the transaction. The command button is linked to a report name "receipt". The problem that I'm having is that when you click the command button it prints the first record in the database regardless of the record you are on. I need the button to print the current record to the report-"Receipt".

Anyone know how to do this....?

All inquries would be warmly recieved
 

Chris RR

Registered User.
Local time
Today, 04:07
Joined
Mar 2, 2000
Messages
354
What is your "Receipt" report based on? You need to create a query that will select data (one record) based on whatever receipt ID is on your form. Then change the source for your "Receipt" report to that query. If your field names are the same, this is an easy change.
 

MSUKevin

Registered User.
Local time
Today, 10:07
Joined
May 16, 2001
Messages
75
Chris,
My reciept report is based on my sales table. Is this my error? I have the transaction ID as the linking field. Are you saying that I need to create a query based on the table and link the info from there??

Please help.... very confused!!
 

KevinM

Registered User.
Local time
Today, 10:07
Joined
Jun 15, 2000
Messages
719
Leave the report as it is, don't put the criteria in the query as this will restrict the report only being able to run with that criteria.

A better way is to add a WHERE condition in the Docmd.OpenReport line of the Click Event of the button....

"[ID Field]=[Forms]![FormName]![IDField]"

Change the above to your Unique ID field and form name.

This is a MUCH better way than putting this criteria in a query, as you are still free to open all records on the report if you want, or you could set different criteria in different forms and still use the one report.

HTH
 

Users who are viewing this thread

Top Bottom