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

Reset all values for a yes / no with a macro or code??

Status
Not open for further replies.

kp1279

Programmer
Jan 21, 2005
43
GB
I have a database, and have a number of reports that will print.

From the main table I have a querie that will return the order sheets that I need.

This query is presented in a Form, so that I can scroll through the records. From the returned records I want to create a combined report which only contains a few of the records. I have introduced a yes/no toggle (combine), and the report looks at the query, and combines the records for the report, based on the selected records with the combine=yes. This bit works.

Now what I want to do is create a button at the bottom of the form which will reset the toggle to no, or unselect all the selected records.

HOW????

I have created a query that finds all the selected fields, and this creates a datasheet with just these fields on, and I want to un-check all of them in one go, but my macro only resets the first record and not the rest.

ANY HELP PLEASE???

Is there another way maybe??
 
DoCmd.RunSQL "UPDATE yourTable SET yourToggleField=False"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have created the button, and gone into the code builder and typed the following:

DoCmd.RunSQL "update orders set combine=false"

this comes back with a run time error, should I have in there coma's etc????

orders = the table
combine = the field

KP
 
with a run time error
any chance you could post the whole error message and the highlighted code when in debug mode ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have changed from having the name of the table to having the name of the query so it looks like this:

DoCmd.RunSQL "update reset set combine=no"

reset = the query

and it now works fine.

Thanks again for your help.

KP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top