Trouble with "Like" parameter.

The_Vincester

Registered User.
Local time
Today, 15:04
Joined
Jun 6, 2006
Messages
71
I can't believe I haven't run into this before, and since search for the forum just gave me a database error...

I have a Form, with combo box parameters that pass to a query that fills a subform. So I can see all the records from the beginning, each parameter uses a
Code:
Like [parameter:] & "*"
criteria.

The problem is that one of my parameters is a number and that if I select 1, it'll also give me 11, 12, 13, etc., or anything that starts with a one (same for 2, 3 and on of course). I realize that with "like" that this is by design, but how do I have it just to show what I'm looking for, but keep the functionality of show everything when nothing is selected.

Please keep in mind that I use "design" mode and never use SQL.
 
Not sure what you mean. I don't see how that could work with my combo box. I need to give them the option to pick between 1 and 300. Using the quotations would give me a "set" parameter, correct?
 
oh i didn't know it was in a combo box .. do

[Forms]![Form Name]![Combo box Name]

for your parameter
 
That'll give me the same issue. Remember, I'm using this in a form with a subform. It's already passing the parameter to the query to use in the subform.

If I use the above, it won't show the results until I enter something. I need it to show all. Then, if they pick all entries that are say a "2," I only want it to show "2," not 2, 21,22,23 (and any other that begin with too).

I appreciate the help, and I'm probably just not making myself too clear.... sorry about that ;)
 
dont use the asterick, so just do like "2"

hopefully that helps
 
That wont give him everything if the selection is blank, I suggest you read this

Brian
 
Brianwarnock said:
That wont give him everything if the selection is blank, I suggest you read this

Brian

Nope, that's not it either.

Let me explain it as names instead of number. When using a "Like" expression, it give you things that are "like" your parameter.

Example: I select Jon and it give me: Jon, Jonathan and Jonas. However, I want ONLY Jon. When I leave it blank, I want Jon, Jonathan, Jonas, Chris, Doug, Dave and any other name I have.

My situation is the same, but I'm using numbers.
 
Obviously Like is not going to give you what you want, but the technique described in that link gives you either exactly what you choose or enter, and if the selection is blank it returns everything, I actually thought that was what you wanted.

Brian
 
I appreciate that, but if you look in my first post, I actually list that technique. Since this is a subform, I don't need the [forms]![form]![parameter], but the idea is the same. Again, sorry if you misunderstand.
 
Brian is right. "Like" is not going to give you what you want.
Use the = operator instead.

-------------------------------------
Field: [FieldName]=[parameter:] or [parameter:] Is Null

Show: uncheck

Criteria: True
-------------------------------------

^
 
Is there no way to use "*" without "Like"? I certainly can't get anything to work.
 

Users who are viewing this thread

Back
Top Bottom