Hello all
Could ny one pl. tell me how to open a report from a form by clicking a button for the same record.the user wnats to hjave the printout for the selected record by pressing a print button.
Tahnks in advance
Does your form have a unique number like an AutoNumber?
If yes, then create a Query for the report and for the criteria pass the value as [Forms]![FORMNAME]![FIELDNAME]
Then on the button that will open the Report you must refresh by me.refresh
If no, then create a field with an AutoNumber unique to the record
leave the acViewPreview off the end to print the report without previewing.
To only print the particular record, you will need to query your data for this particular record. In your report you will need to set the Record Source to your query.
You can use SQL or simply create the query through Access.
When you create your query be sure you include the key field in your criteria so it will pull the particular record.
For example, if the key field on your form is ID, then in the criteria section of your query under the ID field you will need to enter something like this:
Forms!YourFormName!YourFieldName.value
YourFormName refers to the name of the form your pulling the report from.
YourFieldName refers to the name of the field as it appears on the form.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.