Using Toggle Buttons to Filter

dsomers

Registered User.
Local time
Today, 20:27
Joined
Nov 13, 2003
Messages
131
Hello all! In my real estate software, I have my tenants in two groups: active and inactive. On my manage tenants form I have a toggle button that I want to be able to switch between viewing only active tenants or inactive tenants in this form. I just need to add this functionality to it.

How can I accomplish this?

Thanks!
David Somers
 
Last edited:
One way to accomplsih this to to set your form's filter depending on the state of the toggle button.

The following assumes that your button has only two statre, true and false. of course without a default value, the toggle button will be null (neither true, nor false) when your form opens.

For toggle button named btnActive, with a default value fo False, and field fActive is the Boolean field indicating the client state, yes (True) means active, no (False) means inactive.

On event btnActive_AfterUpdate, write the following code

Private Sub btnActive_AfterUpdate()
if me!btnActive then
me!filter="[fActive]=" -1 'True
else
me!filter="[fActive]=" 0 'False
me!FilterOn=true
me.Requery
end sub

On your form's OnOpen event call that subrountine, to get all the records.
 

Users who are viewing this thread

Back
Top Bottom