Full Version: Report generating button on Form
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
mwilliams
I'm trying to create a button on a form that will automatically print a report. I want to use a pull down menu and to have a report automatically generated based on the value of just the field that is selected. I've been through my Access book and can't find a straightforward explanation. I'm assuming I need a lookup field but am not sure where to go from there. Any suggestions? I'm trying to keep user interface on the reporting and query level as limited as possible. Thanks!!
fkegley
Develop a query that fetches the data for the report. The query should use the contents of the form control as its criteria value.

In the Criteria: cell of the relevant column type this:

[Forms]![NameOfForm].[NameOfControl]

Then base your report on the query, and put a button on the form that opens the report.
mwilliams
Thanks!!

I just tried it and am getting and "Invalid Bracketing" error when trying to run the query. I am using:

[Forms]![Print Analyst Report].[Issue List.Contract Name] where "Print Analyst Report" is the name of the form and "Issue List.Contract Name" is the name of the control. Excuse my ignorance, but have I misplaced the brackets?
freakazeud
Hi,
no the brackets are fine, but you should avoid using spaces and special chararcters in control/field/object names.
Try to adapt some naming convention e.g. txtContractName, frmAnaylstReport, rptAnaylstReport...!
HTH
Good luck
mwilliams
Nevermind...figured it out...thanks!
freakazeud
Glad you got it sorted out.
Good luck on future projects!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.