criteria in query from form

2

2Blessed4Stress

I have a query where I want to set the criteria on a text field to look for
the results in a field on my form. The form[frm_WSearchData] field is called
description and has been formated to contain multiple words.
For example: The description field reads: "*pump*" and like "*gear*"
In my qry, I want to search a text data field for the value above. "*pump*"
and like "*gear*"
I have on the criteria line of my query:
[Forms]![frm_WSearchData]![Description]

When I hit run it ask to Enter Parameter Value.
What am I doing wrong?
 
K

KARL DEWEY

You did not say the name of the text field so I will call it TextField and
try this -
SELECT *
FROM [YourTableName]
WHERE [Forms]![frm_WSearchData]![Description] Like "*" &
[YourTableName].[TextField] & "*";
 
2

2Blessed4Stress

I think I need to give you some more information. This is what I have in my
qry's sql:
SELECT *
FROM [SBS_Data]
WHERE [Forms]![frm_WSearchData]![Description] Like "*" &
[SBS_Data].[DESCRIPTION] & "*";


The table SBS_Data has a field name Description. I want to find multiple
words in this field. The user will enter the search words on a form.
(seperate txt boxes for each word up to 5). From this form, I created
another qry that combines all words entered into another form
[frm_WSearchData] so together they look exactly like this:
"*pump*" and like "*gear*"
Am I doing too much or should I just leave all the words in their own
separate text boxes?

KARL DEWEY said:
You did not say the name of the text field so I will call it TextField and
try this -
SELECT *
FROM [YourTableName]
WHERE [Forms]![frm_WSearchData]![Description] Like "*" &
[YourTableName].[TextField] & "*";

--
KARL DEWEY
Build a little - Test a little


2Blessed4Stress said:
I have a query where I want to set the criteria on a text field to look for
the results in a field on my form. The form[frm_WSearchData] field is called
description and has been formated to contain multiple words.
For example: The description field reads: "*pump*" and like "*gear*"
In my qry, I want to search a text data field for the value above. "*pump*"
and like "*gear*"
I have on the criteria line of my query:
[Forms]![frm_WSearchData]![Description]

When I hit run it ask to Enter Parameter Value.
What am I doing wrong?
 
K

KARL DEWEY

With what I posted you would put all the search words in
[Forms]![frm_WSearchData]![Description], separated by spaces. It would pull
all records that have a match to any and all words entered in the form.
--
KARL DEWEY
Build a little - Test a little


2Blessed4Stress said:
I think I need to give you some more information. This is what I have in my
qry's sql:
SELECT *
FROM [SBS_Data]
WHERE [Forms]![frm_WSearchData]![Description] Like "*" &
[SBS_Data].[DESCRIPTION] & "*";


The table SBS_Data has a field name Description. I want to find multiple
words in this field. The user will enter the search words on a form.
(seperate txt boxes for each word up to 5). From this form, I created
another qry that combines all words entered into another form
[frm_WSearchData] so together they look exactly like this:
"*pump*" and like "*gear*"
Am I doing too much or should I just leave all the words in their own
separate text boxes?

KARL DEWEY said:
You did not say the name of the text field so I will call it TextField and
try this -
SELECT *
FROM [YourTableName]
WHERE [Forms]![frm_WSearchData]![Description] Like "*" &
[YourTableName].[TextField] & "*";

--
KARL DEWEY
Build a little - Test a little


2Blessed4Stress said:
I have a query where I want to set the criteria on a text field to look for
the results in a field on my form. The form[frm_WSearchData] field is called
description and has been formated to contain multiple words.
For example: The description field reads: "*pump*" and like "*gear*"
In my qry, I want to search a text data field for the value above. "*pump*"
and like "*gear*"
I have on the criteria line of my query:
[Forms]![frm_WSearchData]![Description]

When I hit run it ask to Enter Parameter Value.
What am I doing wrong?
 
2

2Blessed4Stress

I need to find the words wherever they are in the DESCRIPTION field, in any
order. I run a qry that makes all the words look exactly like - "*word1*and
like *word2*" - Should I do something different?

KARL DEWEY said:
With what I posted you would put all the search words in
[Forms]![frm_WSearchData]![Description], separated by spaces. It would pull
all records that have a match to any and all words entered in the form.
--
KARL DEWEY
Build a little - Test a little


2Blessed4Stress said:
I think I need to give you some more information. This is what I have in my
qry's sql:
SELECT *
FROM [SBS_Data]
WHERE [Forms]![frm_WSearchData]![Description] Like "*" &
[SBS_Data].[DESCRIPTION] & "*";


The table SBS_Data has a field name Description. I want to find multiple
words in this field. The user will enter the search words on a form.
(seperate txt boxes for each word up to 5). From this form, I created
another qry that combines all words entered into another form
[frm_WSearchData] so together they look exactly like this:
"*pump*" and like "*gear*"
Am I doing too much or should I just leave all the words in their own
separate text boxes?

KARL DEWEY said:
You did not say the name of the text field so I will call it TextField and
try this -
SELECT *
FROM [YourTableName]
WHERE [Forms]![frm_WSearchData]![Description] Like "*" &
[YourTableName].[TextField] & "*";

--
KARL DEWEY
Build a little - Test a little


:

I have a query where I want to set the criteria on a text field to look for
the results in a field on my form. The form[frm_WSearchData] field is called
description and has been formated to contain multiple words.
For example: The description field reads: "*pump*" and like "*gear*"
In my qry, I want to search a text data field for the value above. "*pump*"
and like "*gear*"
I have on the criteria line of my query:
[Forms]![frm_WSearchData]![Description]

When I hit run it ask to Enter Parameter Value.
What am I doing wrong?
 

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