Toggle Button in Form and ApplyFilter macro (1 Viewer)

majordoc

New member
Local time
Today, 04:55
Joined
Sep 29, 2020
Messages
24
Hello all

Many thanks for any help offered here. I am sure this is not the right way to do this but this is what I have done so any help gratefully appreciated. I am not a database manager, developer or programmer but a stupid physician grappling with Covid patients and trying to setup a database to streamline care.
I have a patient database with a field caller Trigger_Date. My team access, input and work through mostly through a single form. I want a Toggle Button to apply a filter that only displays records where the Trigger_Date has passed. I am crap with VBA or expressions so used the lowly macro builder.
I inserted a Toggle Button from Control Bar and OnClick embedded the macro ApplyFilter Where Condition = [Trigger_Date] < Date().
Control Name is blank, don't even know what this is for.
Works great, depress the Toggle Button with one click and form filtered. However or repeat clicking the form remain filters despite Toggle button reverting to undepressed state.

Only a small thing but I am trying to build a future proof-ish form for a large team of docs and nurses of varying IT skills so this will make a difference.

Many thanks in advance.
Emmet
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:55
Joined
Oct 29, 2018
Messages
21,358
Hi Emmet. Welcome to AWF!

Try adding an If/Then/Else in your macro. Essentially:

Code:
If Toggle is depressed (True)
    ApplyFilter
Else
    RemoveFilter
End If
 

majordoc

New member
Local time
Today, 04:55
Joined
Sep 29, 2020
Messages
24
Thank you for helping! I still get an error message stating cannot parse that first line - see attached.
Very much a learner here - apologies.
 

Attachments

  • Capture.PNG
    Capture.PNG
    7.5 KB · Views: 274

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:55
Joined
Oct 29, 2018
Messages
21,358
Thank you for helping! I still get an error message stating cannot parse that first line - see attached.
Very much a learner here - apologies.
Hi. Sorry for misleading you. I was just giving you an example of how the code might look like. Try the first line like this:
Code:
If [Toggle270]=True Then
Hope that helps...
 

majordoc

New member
Local time
Today, 04:55
Joined
Sep 29, 2020
Messages
24
Oh that's great - thanks you so much. That really helps our team out.
Thanks again
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:55
Joined
Oct 29, 2018
Messages
21,358
Oh that's great - thanks you so much. That really helps our team out.
Thanks again
Hi. You're welcome. Glad we could assist. Good luck with your project.
 

Users who are viewing this thread

Top Bottom