2009-12-03 39 views
0
SELECT id 
FROM Activity 
WHERE important = see below 

IF [Forms]![Search]![important] = false,尋求既truefalse如果爲假,在訪問SQL

IF [Forms]![Search]![important] = true,搜索查詢真假兩僅供true

我希望你明白我想做的事情。這可能嗎?

回答

3

試試這個:

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

或者,也許(就像ammoQ說)

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

可能最短的形式,雖然不是很易讀:

SELECT id 
FROM Activity 
WHERE important OR NOT @important 
+0

+1喜歡它,ty – 2009-12-03 13:24:36

+0

'@'做了什麼? – Johan 2009-12-03 13:27:39

+0

這意味着:「你的變量在這裏」 – 2009-12-03 13:32:33