Opening report and passing value from form combobox (1 Viewer)

AccessNoob67

New member
Local time
Today, 04:00
Joined
Aug 22, 2023
Messages
6
Hello all,
Complete access noob so please be gentle. I have a report, a query and a form. The query requires a criteria to be entered in order for the report to be populated. Right now if I open the report I get the box to type in the criteria, as to be expected. What I would like to happen is when the report is opened it triggers the form with the combobox to open, I select the value and that value is passed to the query and the report populated. Not at all sure how to go about this. Any help would be appreciated. TIA.
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:00
Joined
Sep 21, 2011
Messages
14,301
Little backward I would have thought?
Usual scenario is to have a form and some form of opening a report, like a button.
Then you pass the ID of the current record to the WHERE argument of the OpenReport command.

For criteria in the query, you can refer to the form controls if they can be part of the criteria.
 

AccessNoob67

New member
Local time
Today, 04:00
Joined
Aug 22, 2023
Messages
6
Little backward I would have thought?
Usual scenario is to have a form and some form of opening a report, like a button.
Then you pass the ID of the current record to the WHERE argument of the OpenReport command.

For criteria in the query, you can refer to the form controls if they can be part of the criteria.
Like I said....total Noob. Okay....so better practice is to open the form, select the value from the combobox, and then click a button that will open the report and pass the value. How do I do that?
 

onur_can

Active member
Local time
Today, 01:00
Joined
Oct 4, 2015
Messages
180
Open the query on which your report is based in the design window and refer to the criteria part of the relevant criteria field in the drop-down box on your form.
 

AccessNoob67

New member
Local time
Today, 04:00
Joined
Aug 22, 2023
Messages
6
Open the query on which your report is based in the design window and refer to the criteria part of the relevant criteria field in the drop-down box on your form.
Okay...so that would be something like putting the form name and the combobox name in the criteria field?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:00
Joined
Oct 29, 2018
Messages
21,473
Hi. Welcome to AWF!

If you're going to use a form and a button to open the report anyway, you might also be able to skip the criteria part in your query. You can easily filter the report using code.
 

AccessNoob67

New member
Local time
Today, 04:00
Joined
Aug 22, 2023
Messages
6
Thank everyone. Was able to get it figured out with all the pointing in the right direction.
 

Users who are viewing this thread

Top Bottom