Thoughts on why query doesn't work?

Status
Not open for further replies.

AUGuy

Newly Registered Idiot
Local time
Today, 12:34
Joined
Jul 20, 2010
Messages
135
Here's the SQL for the query. When I include the IIF statement into the WHERE clause, it doesn't return any records (even though it should). I'm guessing it has something to do with how the statement is organized, but I'm not sure.

Code:
SELECT Tbl_RMS_Current_Day.[ACCOUNT NUMBER], Tbl_RMS_Current_Day.NAME
FROM Tbl_RMS_Current_Day
WHERE (((Tbl_RMS_Current_Day.[ACCOUNT NUMBER])=IIf([Forms]![frm_Search]![frameButtonGroup]=1,([Tbl_RMS_Current_Day].[ACCOUNT NUMBER]) Like "*" & "505" & "*")));
 
WHERE (((Tbl_RMS_Current_Day.[ACCOUNT NUMBER])=IIf([Forms]![frm_Search]![frameButtonGroup]=1,([Tbl_RMS_Current_Day].[ACCOUNT NUMBER]) Like "*" & "505" & "*")));

Just looking at the WHERE clause, your IIF() function is missing the false part

IIF(expression, true part, false part)

Also, if you meant to have: Like "*" & "505" & "*" as the false part, that will not work either because LIKE is another operator like the =
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom