Using Like in a query criteria

I have two choices in a form's combobox.  They are "Alex" and "Ted".

In a query then I am using this criteria in a column:

Like "*" & [Forms]![frmNameSelection]![cboSelection] & "*"

If I select Ted in the combobox and run the query I get just the "Ted" records.  But if I select "Alex" I get all records.

What am I doing wrong?
Who is Participating?
Dale FyeCommented:
What is the rest of your criteria?

I prefer to use something like:
WHERE (TRIM([Forms]![frmNameSelection]![cboSelection] & "") = "")
OR ([SomeFieldName] = '" & [Forms]![frmNameSelection]![cboSelection] & "'")
SteveL13Author Commented:
Forgot to mention, if I leave the combobox blank I DO want all records.
Ryan ChongCommented:
check the value of [Forms]![frmNameSelection]![cboSelection]

so, is your combo box bound to a recordsource? if yes, try to check how your combo box was bound and verify your data and see what values are bound.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.