Problem with the Like Operator

  • Thread starter Thread starter James Frater
  • Start date Start date
J

James Frater

Hello Everyone,

I'd like to pass the text from text box frm_history.txtWildCard into a Like
" *" operator as criteria for field in a query. I'd then use the query to run
a subform.

Example
txtWildCard = Rugby Masters
Field in the query I want to put the Like criteria against = EName

If I put the criteria for "EName" as:
Like"[forms].[frm_history].[txtWildCard]*"

it returns. However if I typed the criteria for Ename as:
Like "Rugby Masters*"

directly in to the query it returns 47 records in the subform, which is
correct

Any thoughts

James
 
Text at the start of a field
Like [forms].[frm_history].[txtWildCard] & "*"

Text anywhere in the field
Like "*" & [forms].[frm_history].[txtWildCard] & "*"
 
Brilliant.

It's works like a treat.

Many thanks

James

RonaldoOneNil said:
Text at the start of a field
Like [forms].[frm_history].[txtWildCard] & "*"

Text anywhere in the field
Like "*" & [forms].[frm_history].[txtWildCard] & "*"

James Frater said:
Hello Everyone,

I'd like to pass the text from text box frm_history.txtWildCard into a Like
" *" operator as criteria for field in a query. I'd then use the query to run
a subform.

Example
txtWildCard = Rugby Masters
Field in the query I want to put the Like criteria against = EName

If I put the criteria for "EName" as:
Like"[forms].[frm_history].[txtWildCard]*"

it returns. However if I typed the criteria for Ename as:
Like "Rugby Masters*"

directly in to the query it returns 47 records in the subform, which is
correct

Any thoughts

James
 
Back
Top