Button to 'unselect' selection in Query

crwc

Registered User.
Local time
Today, 05:36
Joined
Jan 4, 2004
Messages
12
Is it possible to create a 'button' on a form that will 'deselect' all of the Yes/No's that I 'selected in a query.

I have a query where I select items from a yes/no box by checking the box. What I would like the button to do is 'deselect' all the items I've checked.

The query is a 'master' query that contains all the items needed for a particular trip. So, by deselecting the items, I ensure that no items are removed or filtered out when someone else runs the master query; thinking that all the items are listed.

How would I go about do this. If it is possible, I will need lots of help. I'm not good at writing code! just thinking of ideas!

BTW...I have a form with a button that will run the query. So, if the same form can contain the button to 'deselect' the checked items, that would be fine for me.

TIA
 
I'm not sure exactly what you're asking, but if you're asking if you can use a button on a form to change all the field values in a query from yes to no, then the answer is yes.

Have the code behind the On Click event of the button run an update query on your query to flip the values.
 
Is changing a field from yes to no the same thing as leaving the

When I run the 'master' query, the yes/no field does not have a check in it, (i guess a check means Yes; and no check means No).

If I select the items I want I check the Yes/No field. Now when I close the query, (after i'm done with it), I want to have a button that will uncheck all of the items I selected so that when someone else runs the query, they will see the 'master' query with all items unselected.

I hope this helps somemore.

TIA
 
How do I make it 'flip the values'. I've already got a button to run an 'update query'. But I need instructions on how the do the 'flip'.

TIA
 
The syntax for a garden-variety update query is:
UPDATE table SET newvalue WHERE criteria;

So for example:
UPDATE mytable SET myfield=TRUE;
would flip all the values of the field to TRUE. You can set up the code behind the Click event of the button to retain the last set value (use "Static" to define a Boolean variable for example).
 
Sorry to be so 'dumb' with coding. BUt I need all the help I can get.

***Where do I put the "The syntax for a garden-variety update query is: UPDATE table SET newvalue WHERE criteria"? ***

**Here is the code that comes with the button to 'update' a query. **

Private Sub Command13_Click()
On Error GoTo Err_Command13_Click

Dim stDocName As String

stDocName = "qyConcoursSupplyList"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command13_Click:
Exit Sub

Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click

End Sub

*****This is the code to run the query that contains ALL of the items. This query is where I select the items I want to take, and then I run the 'filter by selection' icon.******

Private Sub runConcoursqy_Click()
On Error GoTo Err_runConcoursqy_Click

Dim stDocName As String

stDocName = "qyConcoursSupplyList"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_runConcoursqy_Click:
Exit Sub

Err_runConcoursqy_Click:
MsgBox Err.Description
Resume Exit_runConcoursqy_Click

End Sub

***Again, sorry for 'not' getting the hang of coding!***

TIA
 
Before we go on, what exactly again are you trying to achieve? Are you trying to change the value for all the fields in just one record or one field in all the records?
 
I only want to change the field in the records that have the 'Yes' selected.

When I run the 'master query' it lists all the items that I take on a trip. However, there are times when I only want to take a 'few' of the items on a weekend trip. So, after I run the 'master query' I select items in the YES/NO field, (yes=I'm wanting to take this item) and filter the query so I can see only the items I want to take.

Now, after I close the 'master query' the new button I want would 'deselect' the items I seleted from the master query. I would like the button on the same form where I have the button to run the 'master query'. This way when I go on my next trip I and run the 'master query' can view all items in that 'master query'; without 'checks' on the "This Trip" field, which is the YES/NO field.


Again...many, many Thanks!
 
Still looking for help

I'm still wishing for some help with this problem of mine. All help is very much appreciated!!!
 

Users who are viewing this thread

Back
Top Bottom