Hide/show different records

B

Beth

In a form listing products for sale, I have a checkbox field for "Active".
The list is getting very long and I would liek to add a checkbox on the form
that users can click to hide all products that are marked as inactive, or
click it again to show those inactive products. I am not sure how to
proceed.
I tried placing code in the on update event of a checkbox like the
following, but that didn't work, so I am looking for ideas. Thanks.
Beth

If me.chkHide = True then
Me.recordsource = "Select * from Products"
Else
me.recordsource = "Select * from Products where (products.active = yes)"
End If
Me.refresh
 
G

Guest

Hi Beth,

guess it's not working because you set the recordsource for the wrong control.
You have to change the recordsource for the form.

A fairly easy solution would be to work with a filter.

Try it like this:
Me.Filter = "products.active = true "
Me.FilterOn = True

jokobe
 

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