Pass values from a Access form to a report
Hi All,
I have a simple form in MS Access. It contains a customer ID, name and a command button.
What I want the command button to do is pass the customer ID to a report and print the customers details according to the customer ID.
So the user selects a customer ID clicks the command button and the details of the customer according to ID prints.
Any Thoughts?
mccreaso
Re: Pass values from a Access form to a report
Quote:
What I want the command button to do is pass the customer ID to a report and print the customers details according to the customer ID.
1) Simply set the value of the report control in the OnOpen property of the report:
VB Code:
Report[reportname]: OnOpen
'lets say the textbox will store the Cust ID
Me![TextBox] = Forms!frm[Formname]![custId]
You must open the report before closing the form, otherwise the reference will not be valid.
2) Use Dlookup() for getting the details from the table based on cust ID.
I haven't tried it yet...
Hope it helps...
Re: Pass values from a Access form to a report
Better would be to create a new class and create a read/write property where you can set the value from the form and read it from the report. his will allow the form to be closed or be open still without affecting anything else. :)