Full Version: Run report based on a specific record
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
jsmithbank1000
I am building a database and am now to the point where I have reports developed and a lot of data to base the reports on. I want to build a report "menu" that will allow the user to select a particular record and then run a report based on the ID of the record selected. Anyone know of some controls out there or links that deal with this?
dannyseager
To open a report based on a form control you need to add the criteria in the report open command...

for example if you had a form with a control on it called ID and in there was the number 23, using the following line of code would open the report and only show the record with the ID of 23...

DoCmd.OpenReport "ReportName", acViewPreview, , "ID=" & Me.ID

There any plenty of variations with this (i.e. list boxes, text boxes, combo boxes, bound controls, unbound controls but they all work very much the same)
jsmithbank1000
Thanks very much for the post. It was a big help. Last question:

If I want to return multiple IDs what would that code look like?
dannyseager
Would you want each ID on a seperate report?

If so then check out this recent post...

http://www.utteraccess.com/forums/showflat...p;Number=654085

If not then you would need a multi select list box.

See this post in the code archive by Jerry "Gandalf" Dennison

http://www.utteraccess.com/forums/showflat...mp;Number=95097
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.