Like and Not Like in same criteria (1 Viewer)

PeterWieland

Registered User.
Local time
Today, 10:43
Joined
Sep 20, 2000
Messages
74
Hi,

I have a form that I use to provide the criteria for a query. There are 2 check boxes that are used to exclude 2 particular categories from the query.
This is what I have in the criteria field of the query:

Not Like IIf([Forms]![frmSubjects]![checkIncludeSubject1]=No,"Subject1","") And Not Like IIf([Forms]![frmSubjects]![checkIncludeSubject2]=No,"Subject2","")

This part works fine.

I want to change the way the system works so that a report can be generated as above (i.e list all records, but choose to leave 1 or 2 items out), or to select individual subjects from a combo box.

I have set up the form with an option group which hides either the combo box or the check boxes, but I can't work out how to include the combo box in the criteria.

I think I need a statement that would read like this:

If Option 1 selected, then list records that MATCH combobox, else if Option 2 selected, list records that DO NOT MATCH those indicated by the check boxes, if NOT checked.

Hope this makes sense. I have tried to write this with nested IIf statements, but I get a message that the expression is too complex.

Thanks in anticipation

Peter
 

Mile-O

Back once again...
Local time
Today, 10:43
Joined
Dec 10, 2002
Messages
11,316
That sounds as if you are overcomplicating matters.
Do you have a screenshot or an example of your form?
 

PeterWieland

Registered User.
Local time
Today, 10:43
Joined
Sep 20, 2000
Messages
74
Hello Mile,

I have attached a db with the form in it. I would be extremely grateful if you could come up with something simpler. I think I am at the stage now where I "can't see the wood for the trees"!
 

Attachments

  • db2.zip
    10.2 KB · Views: 87

Users who are viewing this thread

Top Bottom