Create a report using the currently open record

asifbaig

New member
Local time
Today, 04:43
Joined
May 4, 2015
Messages
8
I am creating a database to store patient ultrasound reports in a clinic. The form I've designed contains a single patient's report with various values and measurements. I need a button on that form that opens a report showing ONLY THAT PATIENT'S data.

So, for example, if I've opened the form (AbdomenForm) on patient with ID 4, when I press this button, it should open the report showing only patient ID 4's data.

I can get it to work manually by creating a query (AbdomenQuery) that contains 4 in the criteria for ID (my table's primary key). Then I made a report (AbdomenReport) that uses AbdomenQuery as its data source and everything turns out well.

Now, how do I go about making a button on the form so that when patient ID 5 is open, that button opens the report for only patient ID 5? What code should I use and where should I put it?
 
Thank you. I'll try the link you suggested since it's more flexible.

Though if I wanted to have the query point to the form, how would I go about doing that? As far as I know, in the Query design view, the criteria field cannot be a variable since Access takes it literally. Or something like that. Am I wrong?
 
I have many queries using forms for criteria. I use a mix of the link above and form references as appropriate to each situation.
 

Users who are viewing this thread

Back
Top Bottom