How to do an OR Statement?

L

Leslie

I'm trying to do and OR statement. In the WHERE Statement for the parameter
portion of the query, I need either the PC_NO or the ECRNo, Only one of
these will have data.

Here is the Where statement from the query from SQL:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
Number?] & "*") AND (([TBL_File-Move-Form].ECRNo) Like [What is the ECR
Number?] & "*"))
 
L

Leslie

How do I create the Where statement so that it will use either the PC_NO or
ECRNO not both, they will only be looking for 1 of them or di I have to do 2
queries and thereby 2 forms, etc.

Douglas J. Steele said:
What is your question?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Leslie said:
I'm trying to do and OR statement. In the WHERE Statement for the
parameter
portion of the query, I need either the PC_NO or the ECRNo, Only one of
these will have data.

Here is the Where statement from the query from SQL:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
Number?] & "*") AND (([TBL_File-Move-Form].ECRNo) Like [What is the ECR
Number?] & "*"))
 
K

KARL DEWEY

In an OR statement there must be a match in one of the evaluations. With
these prompts the operator can just press the enter key for the one they do
not have any information on. Both are not required. If there is a match in
both it will not matter expect you may get additional records as some may
match one criteria only.

Leslie said:
How do I create the Where statement so that it will use either the PC_NO or
ECRNO not both, they will only be looking for 1 of them or di I have to do 2
queries and thereby 2 forms, etc.

Douglas J. Steele said:
What is your question?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Leslie said:
I'm trying to do and OR statement. In the WHERE Statement for the
parameter
portion of the query, I need either the PC_NO or the ECRNo, Only one of
these will have data.

Here is the Where statement from the query from SQL:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
Number?] & "*") AND (([TBL_File-Move-Form].ECRNo) Like [What is the ECR
Number?] & "*"))
 
L

Leslie

Okay, I understand that now how do I create the where statement or where type
statement for that? They will still need to enter in the PC or ECR number.

KARL DEWEY said:
In an OR statement there must be a match in one of the evaluations. With
these prompts the operator can just press the enter key for the one they do
not have any information on. Both are not required. If there is a match in
both it will not matter expect you may get additional records as some may
match one criteria only.

Leslie said:
How do I create the Where statement so that it will use either the PC_NO or
ECRNO not both, they will only be looking for 1 of them or di I have to do 2
queries and thereby 2 forms, etc.

Douglas J. Steele said:
What is your question?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I'm trying to do and OR statement. In the WHERE Statement for the
parameter
portion of the query, I need either the PC_NO or the ECRNo, Only one of
these will have data.

Here is the Where statement from the query from SQL:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
Number?] & "*") AND (([TBL_File-Move-Form].ECRNo) Like [What is the ECR
Number?] & "*"))
 
K

KARL DEWEY

I have gotten lost somewhere along the way. Your first post had the
statement you need or is it not working?

Leslie said:
Okay, I understand that now how do I create the where statement or where type
statement for that? They will still need to enter in the PC or ECR number.

KARL DEWEY said:
In an OR statement there must be a match in one of the evaluations. With
these prompts the operator can just press the enter key for the one they do
not have any information on. Both are not required. If there is a match in
both it will not matter expect you may get additional records as some may
match one criteria only.

Leslie said:
How do I create the Where statement so that it will use either the PC_NO or
ECRNO not both, they will only be looking for 1 of them or di I have to do 2
queries and thereby 2 forms, etc.

:

What is your question?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I'm trying to do and OR statement. In the WHERE Statement for the
parameter
portion of the query, I need either the PC_NO or the ECRNo, Only one of
these will have data.

Here is the Where statement from the query from SQL:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
Number?] & "*") AND (([TBL_File-Move-Form].ECRNo) Like [What is the ECR
Number?] & "*"))
 
D

Douglas J. Steele

If you want them to only enter a single value, and then look for that value
in either PC_NO or ECRNO, use:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
or ECR Number?] & "*") OR (([TBL_File-Move-Form].ECRNo) Like
[What is the Product Change or ECR Number?] & "*"))

It's critical that you type the two prompts phrases identically, or you'll
continue to get prompted twice.


Another option might be:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
Number?] & "*") OR ([What is the Product Change Number?] IS NULL))
AND (([TBL_File-Move-Form].ECRNo) Like [What is the ECR Number?] & "*") OR
([What is the ECR Number?] IS NULL)


This means that they'll still get the two prompts, but they can simply hit
Enter for one (or both).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Leslie said:
How do I create the Where statement so that it will use either the PC_NO
or
ECRNO not both, they will only be looking for 1 of them or di I have to do
2
queries and thereby 2 forms, etc.

Douglas J. Steele said:
What is your question?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Leslie said:
I'm trying to do and OR statement. In the WHERE Statement for the
parameter
portion of the query, I need either the PC_NO or the ECRNo, Only one
of
these will have data.

Here is the Where statement from the query from SQL:

WHERE ((([TBL_File-Move-Form].PC_No) Like [What is the Product Change
Number?] & "*") AND (([TBL_File-Move-Form].ECRNo) Like [What is the ECR
Number?] & "*"))
 
Top