Johan
Johan

Reputation: 19072

If false, search both true and false in Access sql

SELECT id
FROM Activity
WHERE important = see below

IF [Forms]![Search]![important] = false, search for both true and false

IF [Forms]![Search]![important] = true, search for only true

I hope you understand what I want to do. Is this possible?

Upvotes: 0

Views: 903

Answers (2)

Rubens Farias
Rubens Farias

Reputation: 57966

Try this:

SELECT id
FROM Activity
WHERE important = @important OR @important = false

Or, maybe (just like ammoQ said)

SELECT id
FROM Activity
WHERE important OR NOT [Forms]![Search]![important]

Upvotes: 3

Erich Kitzmueller
Erich Kitzmueller

Reputation: 36987

Probably the shortest form, though not very readable:

SELECT id
FROM Activity
WHERE important OR NOT @important

Upvotes: 2

Related Questions