Criteria not working....

S

Sheila D

Hello - I have the following SQL code in my query:
SELECT T_Procedures.Consultant, Q_Procedure_Type_Strings.String,
T_Procedures.Date_Of_Procedure, T_Procedures.Length_Of_Procedure,
T_Patients.Surname, T_Patients.Forename,
[Forms]![ChooseF_Consultant_Procedure_Times]![Start Date] AS Expr1,
[Forms]![ChooseF_Consultant_Procedure_Times]![End Date] AS Expr2
FROM T_Patients INNER JOIN (T_Procedures INNER JOIN Q_Procedure_Type_Strings
ON T_Procedures.Procedure_Number = Q_Procedure_Type_Strings.Procedure_Number)
ON T_Patients.Hospital_Number = T_Procedures.Hospital_Number
WHERE
(((Q_Procedure_Type_Strings.String)=[Forms]![ChooseF_Consultant_Procedure_Times]![String] Or (Q_Procedure_Type_Strings.String) Is Null));

If I complete the form with a particular value I get the records I expect
but if I leave it blank I get nothing where I am expecting (or hoping for!!)
all the records. This normally works so I can't see what the problem is this
time, any ideas much appreciated
Sheila
 
S

Sheila D

Sorry - I fixed it by changing the WHERE clause to:
WHERE
(((Q_Procedure_Type_Strings.String)=[Forms]![ChooseF_Consultant_Procedure_Times]![String]))
OR ((([Forms]![ChooseF_Consultant_Procedure_Times]![String]) Is Null));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top