QBF Technique

  • Thread starter Thread starter Stuart Grant
  • Start date Start date
S

Stuart Grant

I have been trying to use the QBF Technique. I downloaded the Microsoft
Support article illustrating the technique in Northwind and tried to
duplicate it. The article says that you must type the following criteria in
one line.
Forms![QBF_Form]![WhatCustomer] Or Forms![QBF_Form]![WhatCustomer] Is Null.
I cannot get it to work. When you click on the Search button, nothing
happens. When you go back into the Query in design mode, you find that
Access has split the criteria up into two lines. You edit, put it back in
one line exactly as the article says. Access changes it again.
What is wrong?
Stuart
 
Stuart said:
I have been trying to use the QBF Technique. I downloaded the
Microsoft Support article illustrating the technique in Northwind and
tried to duplicate it. The article says that you must type the
following criteria in one line.
Forms![QBF_Form]![WhatCustomer] Or Forms![QBF_Form]![WhatCustomer] Is
Null. I cannot get it to work. When you click on the Search button,
nothing happens. When you go back into the Query in design mode, you
find that Access has split the criteria up into two lines. You edit,
put it back in one line exactly as the article says. Access changes
it again. What is wrong?
Stuart

Two lines is fine since two lines of criteria are "ORed" rather then "ANDed".
Something else is the problem.

What is the code behind your search button?
 
The Search button has On Click - QBF_Macro which in turn runs the query. The
whole thing is exactly as in Microsoft Knowledge Base 304428 which very
specifically says that it MUST all be in one line.
Stuart
Rick Brandt said:
Stuart said:
I have been trying to use the QBF Technique. I downloaded the
Microsoft Support article illustrating the technique in Northwind and
tried to duplicate it. The article says that you must type the
following criteria in one line.
Forms![QBF_Form]![WhatCustomer] Or Forms![QBF_Form]![WhatCustomer] Is
Null. I cannot get it to work. When you click on the Search button,
nothing happens. When you go back into the Query in design mode, you
find that Access has split the criteria up into two lines. You edit,
put it back in one line exactly as the article says. Access changes
it again. What is wrong?
Stuart

Two lines is fine since two lines of criteria are "ORed" rather then
"ANDed". Something else is the problem.

What is the code behind your search button?
 
Stuart said:
The Search button has On Click - QBF_Macro which in turn runs the
query. The whole thing is exactly as in Microsoft Knowledge Base
304428 which very specifically says that it MUST all be in one line.
Stuart

In the query designer having two rows of criteria under a single field...

FieldName

Like "*SomeText*"
Like "*SomeOtherText*"

Is exactly the same as the SQL...

WHERE FieldName Like "*SomeText*" OR FieldName Like "*SomeOtherText*"

....and the query design grid will often split this onto two different lines when
the query is saved if it is originally entered on one line. It makes absolutely
no difference. In fact if you look at the SQL view of the query you will see
the OR is still there just as you entered it.
 
Back
Top