Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query must check all checkboxes

Status
Not open for further replies.

Superguppie

Technical User
Jan 19, 2005
107
0
0
NL
hey there,

When i close a form, all checkboxes from a query must be checked. but there are 2 fields that are Yes/No.
1: Ordered.
2: Send.

Well all ordered checkboxes must be checked and not the send checkboxes, how is this done.

Maybe VBA code?

Thanks in advance

Superguppie
 
checkboxes" are a control on a form. You do the checks on values of those controls through code. Queries retrieve, add, update or delete records in a database.

If you are using a form "Bound" to a table then the entries are applied when you move to the next record.

You also need to explain what you want to do in a little more detail.
 
well i did explane this very wrong:( Very Very bad Guppie :S

so i will explane again in full detail:

when a user tries to order something that is not in storage, it comes on a waitinglist. a query will search those record by the ordered checkbox. when they are false the order is placed but it is not in storage. when we enter in our storage form that the product is back and we have enough storage to send all product, all the checkboxes must automaticly be True (but) when the storage of product: Cheese is out and there are 2 orders that are waiting (1 for cheese and 1 for milk) and we enter that we have cheese again, all cheese records must check on Ordered

hope this is a clear explanetion

Superguppie
 
Do you know what an UPDATE query is ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I know what it is, but i dont know how to use it.......
 
so i will explane again in full detail:

Your explanation was not "Full detail", and what would help here is.

Information about your form and how the user uses it. Do you want checks to be done when they click a button, cycle to the next record etc., etc.

VBA code is placed to react to certain situations that you can choose. An example would be the click of a command button, when the form opens, a change to a textbox or the check/uncheck of a checkbox.

How is your form set up, listboxes, comboboxes, or do you just have checkboxes next to labels with the inventory items?

And, what have you tried?

If you can post code with an explanation of what you are trying to do with it, that helps a lot.

This forum helps those that help themselves and the harder you try the more help you will get.
 
A user opens a form name AddStorage, they can change a field named: Count that will hapen trough a combobox where they can fill in howmany of that product has entered the building. then when they click on a button this button will decide if there is more then 0 product on storage trough a VBA code.

this is all fine

then...

a User will order a product. but it isnt in storage so the field: Count is 0 or less. then the order will be placed but the checkbox Ordered will stay False. (in our business we can see if the checkbox is True or False, then we know ah... the product is not on storage and we can buy the product.)

This is also fine

then...

The form AddStorage will be opened as told above and the product that is not on storage will be added. A combobox will let the user input howmany product will enter the building (named: ComboCount)(this is the problem) When the button is clicked the field Count must be updated so the storagesystem see ah there are now (example) 5 product available instead of 0 or less. Then there is a query where all orders with checkbox: Ordered are False, and those records All checkboxes for this product that has been added must be True and all other records must still be False.

I tried a normal query and a Add query
im not so great with SQL so i prefer VBA code.

For the Count i tried this:

Voorraad = (Aantal > 0)

and that seems to work.......... but maybe there is a better code...

for the check all checkboxes, i tried the all checkboxes and a filter in the query but thats no good,...... so my question really is: How can i set a filter so only the checkboxes for the product that has been added are going to change to True.

Hope this is clear now..........
 
As PHV suggested, you need to look into an "Update" query

Example:

Code:
Private Sub cmdUpdateProduct_Click()
Dim strSql As String

DoCmd.SetWarnings False
strSql = "UPDATE Products Set ProductInStock = TRUE WHERE iID = 1"

DoCmd.RunSQL (strSql)
DoCmd.SetWarnings True
End Sub

In this case, if the product "SuperWidget" has an ID number of 1 and I was out but now I recieved a new shipment. Running this query would update the table to show it is in stock

If I did not include the WHERE cluase ALL ProductInStock values would be set to TRUE so it is important to make sure you only update what you need to.

And of course you need to get the Product ID or what ever you are using from the combobox to set up the where cluase so you only update the desired record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top