473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Parameter in query to dropdown list

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
4 3501
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

"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: guitarromantic | last post by:
Hey everyone. I'm re-writing a php Content Management System (based loosely on phpNuke but specific to my site). My first major change was attempting to normalise the Review section database...
1
by: Greg | last post by:
I am tying to set a parameter in a query that will only slect cutomer codes between two given #'s. I have a 3 part query....... 1st I am querying the customer codes that have a current balance. ...
6
by: sheree | last post by:
I would like to create a query where one of the columns of the queries comes from a combo list box on a form. For example, if my table has the following fields: id name interest1 interest2...
2
by: msnews.microsoft.com | last post by:
How do I get Intellisense to open a dropdown list box for a method's parameters when the parameter is an ENUM? public class MyClass { public enum IDkind { PersonID, EntityID, PlaceID
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
2
by: SF | last post by:
Hi, I am new to ASP.NET. I started my first testing ASP.NET by having a ASP page consist of a drop-down control and 1 datagrid bound to Access database. The dropdown control works very well...
1
by: waltnixon | last post by:
I've got an MS Access query which runs fine when double clicked and returns all of the rows in a test database I'm building. I've set up a multi group report based on the query. I immediately...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
0
kcdoell
by: kcdoell | last post by:
Hello: I have a form that I am using to help me display a query that I have built. On that form I have multiple combo boxes that I have called cobMonth, cobYear, cobWorkingRegion, etc......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.