By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

Parameter in query to dropdown list

P: n/a
Hi, i'm making an application in Access and in the query made, i'd
like the user to fill in a parameter when opening the query (in a
report). It's much easier for the user if the parameter was a dropdown
list from which he can select, because the parameters are rather
long...

Does anyone know how to make that dropdown list?

TIA
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
As far as I know, the best way to do this would be to create a table
containing the values you want in you list. Create a pop-up form with a
combo box where the source is the newly created table. Then set the criteria
of your query to Forms!Your_PopUpForm!Your_Combo.

Instead of having a command button to open the report, use the command
button to open the pop-up form. Have another command button on this form
which opens up the report. It may be an idea to add a line of code on the
"open report" command to open the pop-up form as invisible so that it
disappears when the report is run!!!

Some of the guru's may come up with a better solution but that would work!

Mark

"Theo Jansen" <th********@gmail.com> wrote in message
news:6b**************************@posting.google.c om...
Hi, i'm making an application in Access and in the query made, i'd
like the user to fill in a parameter when opening the query (in a
report). It's much easier for the user if the parameter was a dropdown
list from which he can select, because the parameters are rather
long...

Does anyone know how to make that dropdown list?

TIA

Nov 13 '05 #2

P: n/a

"Theo Jansen" <th********@gmail.com> wrote in message
news:6b**************************@posting.google.c om...
Hi, i'm making an application in Access and in the query made, i'd
like the user to fill in a parameter when opening the query (in a
report). It's much easier for the user if the parameter was a dropdown
list from which he can select, because the parameters are rather
long...

Does anyone know how to make that dropdown list?

TIA


This will involve a bit of work and some VBA coding. Basically, you create
a small form with a combobox on it which gets the values from the table.
You also have 2 buttons OK and Cancel. You create a function called
GetMyParameter() as String which opens the form as a dialog and the user
selects the value. Presing OK hides the form, returns the value and the
form can be closed. You can then open the query with that parameter.

Does that point you in the right direction?
Nov 13 '05 #3

P: n/a
I'm trying almost the same thing here, but I still cannot get it to work.
I'm trying to pass a parameter that a user selects from a combo box to a
query. My form is named 'Build' and the combo box is named 'cmbName'. I
type this into the criteria field and Access puts brackets around
everything, 'Forms!Build!cmbName.Value' becomes
'[Forms]![Build]![cmbName].[Value]' (all without the single quote of
course). I've tried every combination of bracks/no brackets that I can
think of, none work. Can someone please tell me the exact syntax for this.

thanks
mike

"Mark" <ma**********@ntlworld.com> wrote in message
news:j9**************@newsfe1-win.ntli.net...
As far as I know, the best way to do this would be to create a table
containing the values you want in you list. Create a pop-up form with a
combo box where the source is the newly created table. Then set the criteria of your query to Forms!Your_PopUpForm!Your_Combo. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Instead of having a command button to open the report, use the command
button to open the pop-up form. Have another command button on this form
which opens up the report. It may be an idea to add a line of code on the
"open report" command to open the pop-up form as invisible so that it
disappears when the report is run!!!

Some of the guru's may come up with a better solution but that would work!

Mark

"Theo Jansen" <th********@gmail.com> wrote in message
news:6b**************************@posting.google.c om...
Hi, i'm making an application in Access and in the query made, i'd
like the user to fill in a parameter when opening the query (in a
report). It's much easier for the user if the parameter was a dropdown
list from which he can select, because the parameters are rather
long...

Does anyone know how to make that dropdown list?

TIA


Nov 13 '05 #4

P: n/a
Hi,

I tried this and it works OK:

SELECT MyTable.First FROM MyTable
WHERE MyTable.First=[Forms]![Form2]![cboFirst];

The 'Value' component in your statement is not needed.

HTH -Linda
"Janine and Mike" <j9*******@earthlink.net> wrote in message
news:Cr***************@newsread3.news.pas.earthlin k.net...
I'm trying almost the same thing here, but I still cannot get it to work.
I'm trying to pass a parameter that a user selects from a combo box to a
query. My form is named 'Build' and the combo box is named 'cmbName'. I
type this into the criteria field and Access puts brackets around
everything, 'Forms!Build!cmbName.Value' becomes
'[Forms]![Build]![cmbName].[Value]' (all without the single quote of
course). I've tried every combination of bracks/no brackets that I can
think of, none work. Can someone please tell me the exact syntax for this.
thanks
mike

"Mark" <ma**********@ntlworld.com> wrote in message
news:j9**************@newsfe1-win.ntli.net...
As far as I know, the best way to do this would be to create a table
containing the values you want in you list. Create a pop-up form with a
combo box where the source is the newly created table. Then set the

criteria
of your query to Forms!Your_PopUpForm!Your_Combo.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Instead of having a command button to open the report, use the command
button to open the pop-up form. Have another command button on this form
which opens up the report. It may be an idea to add a line of code on the "open report" command to open the pop-up form as invisible so that it
disappears when the report is run!!!

Some of the guru's may come up with a better solution but that would work!
Mark

"Theo Jansen" <th********@gmail.com> wrote in message
news:6b**************************@posting.google.c om...
Hi, i'm making an application in Access and in the query made, i'd
like the user to fill in a parameter when opening the query (in a
report). It's much easier for the user if the parameter was a dropdown
list from which he can select, because the parameters are rather
long...

Does anyone know how to make that dropdown list?

TIA



Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.