Toggle Button to Add "Not Like" to Multiple Queries (1 Viewer)

Madmart1gan

Registered User.
Local time
Today, 09:09
Joined
Mar 19, 2014
Messages
12
I have a form with about 10 subforms on it, all of which have queries as source objects. All of these queries are based off the same table which contains a field for Customer. What I would like to do is have a toggle button on this form that, once pressed, essentially adds a "not like" criteria to each of these subforms' queries EX:(Not Like "Customer_A"). When depressed, the queries/subforms should exist as is.

My first issue is that when I add a toggle button, the control wizard does not start. :confused: It starts up fine for any other control, however.
Next, I just need some guidance on what this would look like. For example, I imagine that on the After Update event of the toggle button I would requery each of the subforms, but I'm not sure how to add the "not like" criteria to each of the underlying queries.
 

Madmart1gan

Registered User.
Local time
Today, 09:09
Joined
Mar 19, 2014
Messages
12
I think there is possibly an easier way. Instead of a toggle button, I could use a check box and within the criteria of each query I would put a formula that was something like:

Nz([Forms]![fMain Menu]![chkbxReports_CustomerA],-1)=(Not Like '*' & 'CustomerA' & '*')

This seems to work, kind of. If the checkbox is checked it removes CustomerA. If the checkbox is unchecked, it only shows CustomerA. I want it to show either all customers or all customers excluding CustomerA.


EDIT:

I tried this:

IIf([Forms]![fMain Menu]![chkbxReports_CustomerA]=-1,Not Like '*' & 'CustomerA' & '*',Like '*')
And it returns no records. I broke each part up and entered it as its own criteria and each works perfectly fine. Once the three parts of the condition put together, it returns nothing. I don't get it.
 
Last edited:

Users who are viewing this thread

Top Bottom