Combo and listbox values

dc_sc

Registered User.
Local time
Today, 05:54
Joined
May 30, 2003
Messages
24
Two questions:

1. I am using a series of combo boxes to set parameters in a query. If no value is selected in the combo box, I want the query to ignore it or pull all values in that field. What it seems to be doing is treating a blank combo box value like null, which returns no values in my query.

2. I want to use a list box (I think) to select several parameters for a certain field. For example, in the list box of values 1,2,3,4,5..., I want to select 1,3,5 and have the query select all records with 1,3,5.

Please help me without VB.
 
Have you tried putting a * in as a default for each option box? this way, if the box is not selected as part of the query - the * will pull all the records out instead of none?
 
Still having trouble

1. the asterisk as a default value did not seem to work. Any more ideas for number 1?

2. I still cannot find any way to get a list box with multiple values to go into the query criteria. Is there a way to do this without code? How come referring to the list box as a criteria doesn't work?
 
If you want to pull in all values, your query's criterion must read:

Like(Forms!MyForm!MyListBox).

Then the asterisk will work.
 
Why are you so against using code? I personally find this easier. There's an example in this thread for option 2.

Thread
 
OOPS!

Like(Forms!MyForm!MyListBox)& "*", I meant! This will return all records if there is null in the list box. And, as Hayley says, code is the answer to your other problem
 
Thanks for #1. My only aversion to code is that I am clueless. But, I have to start somewhere, so I will give it a try. Meanwhile, besides this forum, any suggestions on where I can learn the basics?
 
If you get stuck with option 2 I don't mind helping you out. There are some good VB Forums if you want to check them out

VB Forum

Ron's VB Forum

or you can find some further information here:

MSDN

HTH
Hay
 

Users who are viewing this thread

Back
Top Bottom