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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set check box to false in every record

Status
Not open for further replies.

Ali29J

Technical User
May 13, 2004
203
GB
Hi All

have a continuous form listing all customers, against each customer is a check box "Report", i m looking to use a command button to set every customers "Report" check box to false, can anyone help with the code to do every line not just one at a time...

Thanks

Ali
 
Hi

If "Report" is a field in a table you can use:

currentdb.execute "update tablename set report = false"

pjm
 
Hi Ali,

How about this for an alternative (assumming the checkboxes are NOT bound):

Make the checkbox default value unchecked.

Then, on your form, make a command button and just add code to close the current form and then open it back up. Code would look something like:

Sub cmdClear_Click()

DoCmd.Close
DoCmd.OpenForm "MyForm"

End Sub

Seems like that would start you with all of them unchecked when the form loads, and then the 'reset' button would clear any checks you've put in there since the form was opened by just reloading the form essentially.

Just a thought,
GL,

T
 
Hi Ali,

How about this for an alternative (assumming the checkboxes are NOT bound):

Make the checkbox default value unchecked.

Then, on your form, make a command button and just add code to close the current form and then open it back up. Code would look something like (behind a command button on your form):

Sub cmdClear_Click()

DoCmd.Close
DoCmd.OpenForm "MyForm"

End Sub

Seems like that would start you with all of them unchecked when the form loads, and then the 'reset' button would clear any checks you've put in there since the form was opened by just reloading the form essentially.

Just a thought,
GL,

T
 
Ack, double post!

(slight clarification in the second one)

T
 
Hi

"Report" is a table record in the, not sure how the second solution would work seen as changes would be saved on close???

PJM can you elaborate a little, i ve not used this coding before so i m not sure of the structure,

table Record - Report (format Yes/No)
table name - Customer
Require onclick, each "report" checkbox to be unchecked

THanks again

ALi


 
Hi

In the click event of a command button just put this code:

currentdb.execute "update customer set report = false"

pjm
 
hmmm

i must have done something wrong first time round, thanks for your help, worked great

Ali
 
Hi Ali,

My solution, as stated in my post, won't work if the check boxes are bound to a table. Conceptually, I can't understand the value of binding them to the table so I provided a solution for the other possibility.

Glad you found what you were looking for. That's all that matters :)

T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top