Avatar of fklein23
fklein23Flag for United States of America asked on

Using check boxes and button to run query

The source for the combo box is a query that selects from the transaction table and stores the value for later user. I want to make sure that once I select a box and submit is hit that each different button will cause a different update query to run.
For Tardy I need to run an update query to change the selected transactions ID (from combo box) and modify the field "Descript" to 6 and for the excused box I need it to update the record in the "notes" field with excused. I also need to make sure that both boxes CANNOT be checked.

Untitled.jpg
Microsoft Access

Avatar of undefined
Last Comment
Rey Obrero (Capricorn1)

8/22/2022 - Mon
Rey Obrero (Capricorn1)

add an Option Group control to your form ( use the wizard )
the option group will house the option buttons
Rey Obrero (Capricorn1)

ASKER
fklein23

I have created a copy of what I'm dealing with. I get that the option group will give me values but what I need to do is build a code that runs an update query on the button with a conditional

For example the ID stored from the combo box acts as the transaction ID and the control options can determine what to update (ex default value for excused is 1 and its selected > update query that updates notes with Excused or tardy value 2 runs an update query that changes "descript" for transactID to 6)


Also the option group isnt restricting the selection to just one dot
Test.accdb
Your help has saved me hundreds of hours of internet surfing.
fblack61
Rey Obrero (Capricorn1)

fklein23,
create a blank .mdb, import the objects from your .accdb
upload the .mdb
ASKER
fklein23

sorry about that

Also for some reason the option "Change to tardy" is always active which shouldn't be the case... only one option should be selectable at a time and neither should be selected by default
Test.accdb
Jeffrey Coachman

<only one option should be selectable at a time and neither should be selected by default>
Then you need to insert an Option "Group" (instead of using two individual option buttons)
By default an option group will only allow one selection.

There is a wizard to walk you through the steps.

I am sure capricorn1 can help you with the other aspects of this question.

:-)

JeffCoachman
untitled.JPG
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
fklein23

I get that option group restricts entry... The problem I still have is running different queries. Should I make the submit run an if conditional where when pressed it uses the ID from the absent list and runs update queries based on the value selected by the option group? Like if option group value is 1 run "Update note with excused" and when its value is 2 run "Update Abs to Tardy".

If so how do I use the absent and the option groups values? How do I call them?

EX:
If option29 then Update Transaction.notes
else option31 then update field transaction.descript
Where Combo27=Transaction.ID
ASKER CERTIFIED SOLUTION
Rey Obrero (Capricorn1)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jeffrey Coachman

cap,

I'll leave this to you to avoid confusion.

Jeff
ASKER
fklein23

That worked! Thanks cap

How can I make the form reset after I hit submit?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER
fklein23

Had to change some references names but that worked perfect
Rey Obrero (Capricorn1)

what do you mean by reset?