select all for check box..

  • Thread starter ai_enjoi via AccessMonster.com
  • Start date
A

ai_enjoi via AccessMonster.com

HI..
I have a check box field in a continuous form... name is mCheck
I want to have a command button Select All such that when clicked, all check
boxes in the continuous form would be selected...Thank you..
 
J

Jeff Boyce

A continuous form would display a set of records. Are you saying that you
want all the records in the set marked with a check-mark?

If so, one way to do this would be to run a query via code behind the
command button that updates the field underlying the checkbox in all the
records of that set.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

ai_enjoi via AccessMonster.com

Yes... I want all the records in the set marked..What possible codes should I
use? Thanks..
 
M

Mark A. Sam

I posted this the other day, but on another thread somehow. Sorry for the
delay.

Put a button on the Form header and add this code into the Click event:

rst.MoveFirst
Do Until rst.EOF
rst.Edit
rst![mCheck] = 0
rst.Update
rst.MoveNext
Loop

rst.Close
Set rst = Nothing

If you want to alternate from check to unchecked change line,

rst![mCheck] = False

to

rst![mCheck] = Not rst![mCheck]

An alternative method is this:

With Me.RecordsetClone
.MoveFirst
Do Until .EOF
.Edit
![mCheck] = False
.Update
.MoveNext
Loop
End With

I posted the first procedure becuase this isn't looping through the records
for some reason on my machine with Access 2007.

God Bless,

Mark A. Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top