Problem with the Like Operator

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
 
R

RonaldoOneNil

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

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

James Frater

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
 

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