Query Parameter

Splity

Registered User.
Local time
Today, 08:35
Joined
May 8, 2001
Messages
16
Hi,
Is there a way of changing the input box when you enter a query parameter to a drop down list linked to a table?
Say for instance you need to enter a name of a town to run your query and you want to give the user a list of available town names in you table.
 
Change the criteria to use the item selected from the combo.
Set the query criteria to Forms!SomeFormName!ComboName
HTH
 
In the criteria of your query;
[Forms]![Form Name]![List Box Name]
 
Hi,
I have tried the suggestions but I still can't get it to work.
The parameter box comes up with what I typed in the criteria as the prompt in the box.
What am I doing wrong??
 
Yep I have the same result...My original post appears just before yours,so watching with interest
 
Intersting thing is [formname]
Which [formname],the one where yr list/combobox is? or where u r tring to get yr data,or where u got the [formname] tables from.
Mind u I have tried all alternatives and no result,but getting the right one eliminates one more possibility
 
I have tried several possibilities too but no luck.
I have tried creating a separate unbound form to use instead of the parameter box but that won't work either!
 
Finally managed to crack it.
Create a new unbound form.
Put an unbound combo box in the form and set the ROW SOURCE to link to the table that holds all the option for you original combo box.
Put an unbound Textbox in the new form and set the CONTROL SOURCE property to equal the new combo box and set the VISABLE property to NO.( This is needed or the query will pick up all the values in the combo box instead of just one).
Create two control buttons ( OK and Cancel).
The OK button will use a macro to run the query.
On your query set the criteria in the field you are using to control the query to
[Forms]![new form name]![Textbox name]
(Textbox name being the one you have just created).
Now use the new form to run your query.
It works fine for me giving a drop down list for the query parameter. It does seem a bit long winded so if anyone knows a simpler way please let me know.
 
saw yr latest response.
however after much stuffing around have come up with a much simpler solution that works (at least for me)
I have my listbox set up on my opening splash screen.

Setup a new MACRO
select "runcode" and enter
[forms]![yrformname]![comboboxname]
(In my case: [forms]![splash]![combo31]

select "openquery" and enter in "queryname"
yr querynumber/name
(note comboboxnumber/name= what access calls combobox....in my case "combo31"

Interestingly though a similar setup didnt work for a "listbox",but thats another prob,for another day.
I can now move on to the next part
 

Users who are viewing this thread

Back
Top Bottom