Link to home
Start Free TrialLog in
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
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

add an Option Group control to your form ( use the wizard )
the option group will house the option buttons
Avatar of fklein23

ASKER

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
fklein23,
create a blank .mdb, import the objects from your .accdb
upload the .mdb
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
<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
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
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
cap,

I'll leave this to you to avoid confusion.

Jeff
That worked! Thanks cap

How can I make the form reset after I hit submit?
Had to change some references names but that worked perfect
what do you mean by reset?