Select All command button

RBorg

Board Regular
Joined
Sep 23, 2002
Messages
53
I have created a subform that will show all of my subcontractors in a table view. I would like to create a command button that will change the value of a checkbox called "blnSent" to TRUE on ALL of the records in the table when clicked. Does anyone know a code for this? :p
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi, you can achieve this by creating a new update query that updates the field "blnSent" to true for all records in the table (ask if you are not sure about that bit). Save the query.

Once the query is set up, create a new macro that opens (i.e. runs) this query and then re-querys the form (a "requery" has the same impact as closing and opening the form, if you don't do it then the changes from the update query won't show on the form). Save the macro.

On your form, create a new command button and have it run your macro. Save the form and test it.

You might also want to look at adding a few more lines to your macro e.g. turn off the echo at the start and turn it back on at the end, plus turn off the "setwarnings" at the start and turn it back on at the end too. This way your screen won't jump around while the macro is running and you won't get the on-screen prompts with the update query.

HTH, Andrew. :)
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top