View Full Version : Multiple Choice Parameters???
Yecats131 04-22-2008, 11:10 AM I'm trying to setup a parameter that has a multiple choice so to speak. Rather then the user being able to enter whatever data they want.. I would like them to have a choice between two items.
Is it possible? if so.. how do I do it?
Thanks!
pbaldy 04-22-2008, 11:47 AM You could use a combo box on a form to present the 2 options to the user. Have the query look at the combo for the criteria.
mmcginn2 04-22-2008, 11:59 AM Not sure how advanced you are, but to add a little to the previous reply, it's sometimes easier to add a table with the possible choices and then include it in the combo box choice. To get to the combo box, you'll have to set the data type to lookup wizard, which will give you all the options you need.
Yecats131 04-22-2008, 12:03 PM Thanks for the response you two! I actually have a combo box setup that I want the chooses to be. I'm just not sure how to have the parameter display them?
I'm a beginner with access... so please speak n00b! :0)
Thanks!
pbaldy 04-22-2008, 12:10 PM The criteria would be:
Forms!FormName.ComboName
Yecats131 04-22-2008, 12:13 PM Okay, so I put that in. When I run it, it prompts the box to ask for the user to type in the parameter.
What I'm wondering, is if the user can have something to pick from rather then having to know what the choices are from prior use of the form.
IE:
Combo Box has: Replacement and Additional
Parmater pops up and displays the choices for the user.
Thanks!
pbaldy 04-22-2008, 12:23 PM If you get the parameter prompt, either the form is closed or one of the names is misspelled.
Yecats131 04-22-2008, 12:27 PM Oh... it was because the form was closed. I didn't realize that caused it.
Okay, so new problem! :0) Now, instead of getting a prompt it just pops up with everything that is "Addition". I still need the user to be able to choose which they want. (Replacement or Addition).
Villarreal68 04-22-2008, 12:28 PM Look at this quick and dirty example...
Specifically look at the query....
pbaldy 04-22-2008, 12:32 PM It should return whichever records match the choice made in the combo. Can you post a sample db?
Villarreal68 04-22-2008, 12:54 PM The Reg Query.jpg does not work...
Yecats131 04-22-2008, 12:58 PM Oh okay, so I was taking some screenshots for you and I think I figured it out.
What the query does, is it bases its results on the record that I have open, and what in particular that record has picked. So, if I have one open that has an "Addition" selected, it pulls all of the Additions.
What I wanted, was for the user to run a query based off of the ENTIRE TABLE and select at that time whichever they are looking for.
Villarreal68 04-22-2008, 01:00 PM That is doable, what you need to do is choose some other fields to filter by and do that same you did with the "Additions" field.
That way you are modifying the quiery according to what is on the form.
Yecats131 04-22-2008, 01:05 PM I'm not sure that I'm following you... :0)
Villarreal68 04-22-2008, 01:08 PM Let me understand:
The form you are working with, the one you did a screen shot of, is the information you want for the record you are looking for, correct?
If that's the case, select a few more distinct fields that you have on that form and reference them on your query the same way you did the "Mutiple Choice" parameter you worked on a few post above.
That way you are filtering the records on the database to get to the record you want. (If you could post a limited sample of the database it would be easier to understand.)
Yecats131 04-22-2008, 01:11 PM Ohhh... No... :0)
Basically, I want to setup a query so that it pulls up All of a type. So either All Additions or all Replacements. The thing is, I want it to provide a prompt at the time of the query for the user to pick rather then the query base itself off of the record that is currently open.
However, I do not want the user to have to memorize the two choices... I want the prompt to display the choices for them to pick.
Villarreal68 04-22-2008, 01:30 PM OK easy enough in the query enter the following:
[Enter ADDITIONS or REPLACEMENT]
This should give them the two words they need to know. They will still need to enter them, but they will be right in front of them to see.
The Brackets [] will prompt them to enter and the words inside the brackets: Enter ADDITIONS or REPLACEMENT will show on the prompt.
Hope it's what you're looking for. Give it a try.
The other way to do it is to create a form to popup when they click to run the query and from within that form have the Multiple Choice Combo box and then run the query from there. That's if you want a combo box to control the input.
Yecats131 04-22-2008, 01:43 PM Actually yes.. that solves my problem.
Sorry for being so confusing... Although I know what you guys just taught me will come in handy... So it wasn't a waste. :)
Thank you!!!
Villarreal68 04-22-2008, 01:55 PM I know. I'm still learning too. This site rocks! People like Pbaldy, RuralGuy, BobLarson and others that share their knowledge and time are the bomb!
They have taught me so much!
Thanks to all the regulars here!
Yecats131 04-22-2008, 02:19 PM Oh I just read this:
The other way to do it is to create a form to popup when they click to run the query and from within that form have the Multiple Choice Combo box and then run the query from there. That's if you want a combo box to control the input.
Do you mind walking me through this? I can definately forsee that being helpfull. Basically, How do I have the query show a form?
Thanks!
Villarreal68 04-22-2008, 03:06 PM Basically you make a button that calls the form. Then within that form you make the combo box with the two selections. and antoher button that calls the Query. That way it works like you had it before, but you have the query look for the answer on this new form's combo box.
You enter in the Query's field you want to filter: Form!NewForm!NewCombobox.
It's time for me to go home but I'll respond to any question you may have tomorrow.
Yecats131 04-23-2008, 07:36 AM Oh, it makes sense. I'll have to try this out a little later today.
Thanks again for all of your help!
Villarreal68 04-23-2008, 12:39 PM YAW! Glad to be of help!
|