How to do an OR Statement?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?] & "*"))
 
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?] & "*"))
 
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?] & "*"))
 
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?] & "*"))
 
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?] & "*"))
 
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?] & "*"))
 

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

Back
Top