Set query parameter from Button selected on Switchboard

JMHScot

New member
Local time
Today, 23:13
Joined
Sep 1, 2022
Messages
11
I have a DB of reports, each report has a Status field– with one of either Open, Active, Archived as the status type.

On my customised switchboard I currently have 3 buttons, Open, Active, Archived which when clicked will open the report for whichever Status I have clicked – this via 3 separate queries each with the appropriate parameter of Open, Active, Archived as set for the Status field.

I would like to tidy up the DB by having only 1 query with the parameter for the Status field being called from whichever button is selected. How would I set this in the query or button control. I know I could use drop down list etc, but would prefer to keep the button options. Thanks John
 
Welcome to the forums! We are the most active Microsoft Access community on the internet by far, with posts going back over 20 years!

To get started, I highly recommend you read the post below. It contains important information for all new users to this forum.

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We look forward to having you around here, learning stuff and having fun!
 
add an Unbound Textbox (name it txtStatus) to your Switchboard.
Set it's Visible property to No.
add code to Each buttons so that you Set the Value of txtStatus, when those 3 buttons are pressed.
On "Open" button, you will use this:

Me!txtStatus = "Open"
DoCmd.OpenReport "yourReportName"

just use 1 query for the 3 reports with Criteria on "Status" field:

Criteria: [Forms]![yourSwitchBoardFormName]![txtStatus]
 
add an Unbound Textbox (name it txtStatus) to your Switchboard.
Set it's Visible property to No.
add code to Each buttons so that you Set the Value of txtStatus, when those 3 buttons are pressed.
On "Open" button, you will use this:

Me!txtStatus = "Open"
DoCmd.OpenReport "yourReportName"

just use 1 query for the 3 reports with Criteria on "Status" field:

Criteria: [Forms]![yourSwitchBoardFormName]![txtStatus]
Thanks Arnelgp, Have tested on one query only, as busy now, but it works, so will do others later. Thanks for prompt reply. John
 
Thanks Arnelgp, Have tested on one query only, as busy now, but it works, so will do others later. Thanks for prompt reply. John
Updated all and everything works fine. Thanks
 

Users who are viewing this thread

Back
Top Bottom