datasheet subform checkbox to all checked

M

mwilliams4

I have a subform which is a datasheet that has a checkbox (Y/N) field
that I would like to check all by using a button on the main form. I
would do this after filtering down to the records that I want to check
off then hit the button to check them all. I want to make sure that
I'm only checking those "filtered down records", and not the entire
table.

Any help would be appreciated.
 
M

Marshall Barton

I have a subform which is a datasheet that has a checkbox (Y/N) field
that I would like to check all by using a button on the main form. I
would do this after filtering down to the records that I want to check
off then hit the button to check them all. I want to make sure that
I'm only checking those "filtered down records", and not the entire
table.


For that to happen, the field and all the (filtered) records
will be updated in the table. If you are sure that's what
you want, make a backup of the table and try this:

With Me.RecordsetClone
.MoveFirst
Do Until .EOF
.Edit
!thefield = True
.Update
.MoveNext
Loop
End With
 
M

mwilliams4

I get error 7951, invalid reference to a recordsetclone property.

Here is the button code in the main form Y/N field name is BillingYN


Private Sub Command2_Click()

With Me.RecordsetClone
.MoveFirst
Do Until .EOF
.Edit
!BillingYN = True
.Update
.MoveNext
Loop
End With

End Sub
 
M

Marshall Barton

I get error 7951, invalid reference to a recordsetclone property.

Here is the button code in the main form Y/N field name is BillingYN


Private Sub Command2_Click()

With Me.RecordsetClone
.MoveFirst
Do Until .EOF
.Edit
!BillingYN = True
.Update
.MoveNext
Loop
End With

End Sub


I think that implies the main form does not have anything in
its record source property. That tells me your button is on
the main form and the records are in the subform. If I
finally got it straight, change the With statement to:

With Me.subformcontrol.Form.RecordsetClone
 

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