Cant get 'Like' to work (1 Viewer)

widemonk

Registered User.
Local time
Today, 14:10
Joined
Jun 16, 2005
Messages
48
I have created a query thats initiated by a command button from a form and one of the criteria for the query is a 'Like' command.

On the form, various option buttons and combi-boxes determine the search criteria and put it into a hidden textbox. Then, the query is run based on the contents of that hidden textbox using 'Like'.

However, I cant seem to get the 'Like' command to work with the contents of the hidden [forms]![frmSearch].[txtSearchcriteria] field.

Do I need to edit the VB code on the form to format the text to include the Like '* prefix and *' suffix, or should my search box remain basic text and have the Like command in the query ??

I seem to have tried loads of variations incorporating the various components of the Like command (the asterisks, single quote marks and even the Like command itself) on either the Form field or query but nothing seems to work. Anyone have any ideas ??

Thanks chaps.
 

boblarson

Smeghead
Local time
Today, 06:10
Joined
Jan 12, 2001
Messages
32,059
You would need to include the asterisks.

Like "*" & [Forms]![YourFormName].[YourControlName] & "*"
 

Users who are viewing this thread

Top Bottom