Clearing Checkboxes?

J

Jim

Hello,
I have a form that lets users select envelopes to print with a check box. I
want to be able to clear the boxes by clicking a button. I'm using the
following code in the on click event, but it only clears the last check box
and not all of them. Does anyone know what I'm doing wrong?

Private Sub Command22_Click()
Me.[Print] = Null

End Sub

Thanks
Jim
 
B

Barry Gilbert

Is the Print field in the form's detail section and bound to a record or is
it in one of the Header/Footer sections?
 
J

Jim

The print button is in the Footer section and I use a query to only print
the records with a true value in the check box.

Barry Gilbert said:
Is the Print field in the form's detail section and bound to a record or
is
it in one of the Header/Footer sections?

Jim said:
Hello,
I have a form that lets users select envelopes to print with a check box.
I
want to be able to clear the boxes by clicking a button. I'm using the
following code in the on click event, but it only clears the last check
box
and not all of them. Does anyone know what I'm doing wrong?

Private Sub Command22_Click()
Me.[Print] = Null

End Sub

Thanks
Jim
 
B

Barry Gilbert

When you say Me.[Print]=Null, it will only point to the selected record. To
deselect the checkboxes for all the records, you'll need to do a loop.
Something like this:

Me.Recordset.MoveFirst
Do Until Me.Recordset.EOF
Me.[Print]=Null
Me.Recordset.MoveNext
Loop

Barry

Jim said:
The print button is in the Footer section and I use a query to only print
the records with a true value in the check box.

Barry Gilbert said:
Is the Print field in the form's detail section and bound to a record or
is
it in one of the Header/Footer sections?

Jim said:
Hello,
I have a form that lets users select envelopes to print with a check box.
I
want to be able to clear the boxes by clicking a button. I'm using the
following code in the on click event, but it only clears the last check
box
and not all of them. Does anyone know what I'm doing wrong?

Private Sub Command22_Click()
Me.[Print] = Null

End Sub

Thanks
Jim
 
J

Jim

Thanks, that worked great!

Jim

Barry Gilbert said:
When you say Me.[Print]=Null, it will only point to the selected record.
To
deselect the checkboxes for all the records, you'll need to do a loop.
Something like this:

Me.Recordset.MoveFirst
Do Until Me.Recordset.EOF
Me.[Print]=Null
Me.Recordset.MoveNext
Loop

Barry

Jim said:
The print button is in the Footer section and I use a query to only print
the records with a true value in the check box.

Barry Gilbert said:
Is the Print field in the form's detail section and bound to a record
or
is
it in one of the Header/Footer sections?

:

Hello,
I have a form that lets users select envelopes to print with a check
box.
I
want to be able to clear the boxes by clicking a button. I'm using the
following code in the on click event, but it only clears the last
check
box
and not all of them. Does anyone know what I'm doing wrong?

Private Sub Command22_Click()
Me.[Print] = Null

End Sub

Thanks
Jim
 
Top