Criteria Expression within a Form

J

jwinder

I have created a "Query Form" where I want to type in certain values in
different fields and have the query return the results on the table being
queried. For example...I have a field called "Part Description" and I want to
type in "tank". Then push the "Run Query" button i have and have the tabgle
pop uip with all the parts descriptions that have "tank" in it. I beleive I
have to write an expression in the "criteria" field of each filed with the
table I am quering...correct so far?? And I believe I want/need to use the
wildcard (*) so I only have to type in minimal data to get the results I want.

Any suggestions?
 
D

Dennis

In the criteria row of the Part Description column put this

Like "*" & Forms![Query Form]![Part Description] & "*"
 
J

jwinder

Thank you sir...worked like a charm!!!!

One thing though....it changed your expression automatically to:

Like "*" & [Forms]![Query - Catalog Append Table]![PODescription] & "*"

Put brackets around "Forms" .

Dennis said:
In the criteria row of the Part Description column put this

Like "*" & Forms![Query Form]![Part Description] & "*"

jwinder said:
I have created a "Query Form" where I want to type in certain values in
different fields and have the query return the results on the table being
queried. For example...I have a field called "Part Description" and I want to
type in "tank". Then push the "Run Query" button i have and have the tabgle
pop uip with all the parts descriptions that have "tank" in it. I beleive I
have to write an expression in the "criteria" field of each filed with the
table I am quering...correct so far?? And I believe I want/need to use the
wildcard (*) so I only have to type in minimal data to get the results I want.

Any suggestions?
 
J

jwinder

Now I have another problem with the same thing...what if in one of the fields
I want it to match exactly a 6 digit number? I have tried putting an "equal"
sign (=) in place of where "like" is...but it didn't work.

Dennis said:
In the criteria row of the Part Description column put this

Like "*" & Forms![Query Form]![Part Description] & "*"

jwinder said:
I have created a "Query Form" where I want to type in certain values in
different fields and have the query return the results on the table being
queried. For example...I have a field called "Part Description" and I want to
type in "tank". Then push the "Run Query" button i have and have the tabgle
pop uip with all the parts descriptions that have "tank" in it. I beleive I
have to write an expression in the "criteria" field of each filed with the
table I am quering...correct so far?? And I believe I want/need to use the
wildcard (*) so I only have to type in minimal data to get the results I want.

Any suggestions?
 
J

jwinder

And yet another problem...

If any of the records have no data in any fields, I do not get that returned
from the query. IE: Record (1) has a blank field in one of the 8 fields and
if I am quering on all 8 of the fields, that record is not returned. Do I
have to use an IF THEN Statement and use the "IS NULL" operator some how?

jwinder said:
Now I have another problem with the same thing...what if in one of the fields
I want it to match exactly a 6 digit number? I have tried putting an "equal"
sign (=) in place of where "like" is...but it didn't work.

Dennis said:
In the criteria row of the Part Description column put this

Like "*" & Forms![Query Form]![Part Description] & "*"

jwinder said:
I have created a "Query Form" where I want to type in certain values in
different fields and have the query return the results on the table being
queried. For example...I have a field called "Part Description" and I want to
type in "tank". Then push the "Run Query" button i have and have the tabgle
pop uip with all the parts descriptions that have "tank" in it. I beleive I
have to write an expression in the "criteria" field of each filed with the
table I am quering...correct so far?? And I believe I want/need to use the
wildcard (*) so I only have to type in minimal data to get the results I want.

Any suggestions?
 
S

Sheila

This line was VERY helpful...
Like "*" & [Forms]![formname]![controlname] & "*" to bring back part of a
field.
I also found this helpful to bring back the entire field or if the field is
left blank.
[Forms]![formname]![controlname] or [Forms]![formname]![controlname] is
null

THANK YOU

Dennis said:
In the criteria row of the Part Description column put this

Like "*" & Forms![Query Form]![Part Description] & "*"

jwinder said:
I have created a "Query Form" where I want to type in certain values in
different fields and have the query return the results on the table being
queried. For example...I have a field called "Part Description" and I want to
type in "tank". Then push the "Run Query" button i have and have the tabgle
pop uip with all the parts descriptions that have "tank" in it. I beleive I
have to write an expression in the "criteria" field of each filed with the
table I am quering...correct so far?? And I believe I want/need to use the
wildcard (*) so I only have to type in minimal data to get the results I want.

Any suggestions?
 
Top