How to hide record if checkbox ticked

bar891

Registered User.
Local time
Tomorrow, 07:53
Joined
May 7, 2008
Messages
39
I have a subform that populates from a query from a table. I also have a checkbox as part of the table. If the checkbox is ticked, I don't want that record to show in the subform
 
There are other ways to do this, but here is one.

If Me.CheckBox = True Then
Me.SomeField.Visible = False
Else
Me.SomeField.Visible = True
End If

HTH
 
I want it to hide the whole row not just a single field
 
I'm trying to do the same thing on a subform. I've got a yes/no field called 'Archive' and have filtered the Form to show records where [Archive] is 'false' however all records are still being displayed. Any suggestions or help greatly appreciated. A screen shot is attached.
 

Attachments

is the Property on the pdf for the subform?
 
on the "main" form's checkbox (is it bound or unbound?), add
code to it's AfterUpdate event . Note that you need to replace the checkbox/subform name with
the correct name:

private sub checkboxName_AfterUpdate()
Me![theSubformName].Form.RecordSource = "select * from [tbl-catheters] where [archive] = " & me!chkboxName
end sub
 
On
on the "main" form's checkbox (is it bound or unbound?), add
code to it's AfterUpdate event . Note that you need to replace the checkbox/subform name with
the correct name:

private sub checkboxName_AfterUpdate()
Me![theSubformName].Form.RecordSource = "select * from [tbl-catheters] where [archive] = " & me!chkboxName
end sub
the checkbox is bound to it's own field in the same table as the other fields. Have tried the method suggested and it's still not working. The form references a linked table. That shouldn't make any difference should it??
 
If you are updating the checkboxes live, you will need to requery your subform everytime an update is made to show the updated ticked rows only
 
If you are updating the checkboxes live, you will need to requery your subform everytime an update is made to show the updated ticked rows only
Yes i've done that. Even closing and re-opening both Forms and even the entire database doesn't solve the issue. Have started swearing at the screen to see if that helps....
 
I probably should have also stated i'm viewing the Form in 'datasheet' view. I wouldn't have thought that should make a difference should it???
 
Yes i've done that. Even closing and re-opening both Forms and even the entire database doesn't solve the issue. Have started swearing at the screen to see if that helps....

Strange, did your smacking your screen? :)

It should be pretty straight forward, the subform's recordset should say Select * FROM TableName where CheckBox = -1, that should do the trick along with a requery of that subform when needed. Datasheet subform shouldn't matter.

If you can share a mini version of your database I can have a look, will be hard to troubleshoot otherwise.
 
Have you actually switched the filter on?
Me.FilterOn = True
 
can you save the record when the checkbox is clicked?

private sub checkboxName_AfterUpdate()
Me.Dirty = False
Me![theSubformName].Form.RecordSource = "select * from [tbl-catheters] where [archive] = " & me!chkboxName
end sub
 
Thanks for all the feedback folks. Recreated the form from scratch and it now works as it should. Must have been some little bug somewhere associated with the previous form. Thanks once again for all your responses.
 

Users who are viewing this thread

Back
Top Bottom