473,657 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parameter query with a list/combo box plz help

6 New Member
Firstly a description of the situation to give you an insight. have a table of motorcycles (Registration no.,makes,model s,colour,no.own ers, etc. and i would like to be able to run a query that allowed me to view only bikes of one make.

i would like to know if there is way of making the parameter prompt a list/combo box contain the values within the motorcycles table so only motorcycle makes within the table can be queried (searched).

ive tried out using a form with a unbound combo box (Makecombo) and using a button to run the macro to open the query. within the query using criteria "[Forms]![Motorcycles Make]![Combo25]" how ever no matter what make i select using the combo box and then click the button the query opens and appears blank.

any help would be greatly appriciated. =D

plz reply ASAP.
Sep 18 '07 #1
11 3088
BradHodge
166 Recognized Expert New Member
Firstly a description of the situation to give you an insight. have a table of motorcycles (Registration no.,makes,model s,colour,no.own ers, etc. and i would like to be able to run a query that allowed me to view only bikes of one make.

i would like to know if there is way of making the parameter prompt a list/combo box contain the values within the motorcycles table so only motorcycle makes within the table can be queried (searched).

ive tried out using a form with a unbound combo box (Makecombo) and using a button to run the macro to open the query. within the query using criteria "[Forms]![Motorcycles Make]![Combo25]" how ever no matter what make i select using the combo box and then click the button the query opens and appears blank.

any help would be greatly appriciated. =D

plz reply ASAP.
If you just want to query the data, you could build the query to look through the motorcycle table. In the "make" column, put [Which Make?] in the criteria line. This will prompt the user to type in the Make that they would like to search.

Hope that helps, and Welcome to theScripts!

Brad.
Sep 18 '07 #2
mezmerize
6 New Member
hi cheers thanks for the help.

your method stated could be used but i don't want the user to be able to search for makes that aren't within the motorcycles table and i also don't want to have to type in the make to be search manually as it can lead to validation and data entry errors is there a way to put a combo box/drop down list of the values in the motorcycles table (in the motorcycles table i already have a drop down value list of makes so they do not have to be entered manually.
Sep 18 '07 #3
BradHodge
166 Recognized Expert New Member
hi cheers thanks for the help.

your method stated could be used but i don't want the user to be able to search for makes that aren't within the motorcycles table and i also don't want to have to type in the make to be search manually as it can lead to validation and data entry errors is there a way to put a combo box/drop down list of the values in the motorcycles table (in the motorcycles table i already have a drop down value list of makes so they do not have to be entered manually.
Sure... On your form build a combo box using the wizard. Have it look for values in your query (specifically the make of motorcycle).

You could then do things one of two ways (at least :). If you just wanted to open the query, you could put the combo box control name in the criteria line of your query (such as Forms![frmBikes]![cboMakes]). Then you would have the AfterUpdate event of the combo box say...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery "qryBikes"
.
If however, you wanted all your data to appear on a form, you would use the combo box to filter your form. I usually use a small form with just the combo box on it to pose the question... "What do you want to look at?". In the After Update event of the combo box, you would have something like...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm,,,"[Make]='" & Me.cboMakes & "'"
Then, just have your small selection form close as the main form opens.

Hope this helps. Let me know if you get stuck.

Brad.
Sep 19 '07 #4
mezmerize
6 New Member
Sure... On your form build a combo box using the wizard. Have it look for values in your query (specifically the make of motorcycle).

You could then do things one of two ways (at least :). If you just wanted to open the query, you could put the combo box control name in the criteria line of your query (such as Forms![frmBikes]![cboMakes]). Then you would have the AfterUpdate event of the combo box say...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery "qryBikes"
.
If however, you wanted all your data to appear on a form, you would use the combo box to filter your form. I usually use a small form with just the combo box on it to pose the question... "What do you want to look at?". In the After Update event of the combo box, you would have something like...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm,,,"[Make]='" & Me.cboMakes & "'"
Then, just have your small selection form close as the main form opens.

Hope this helps. Let me know if you get stuck.

Brad.
cheers ill try that now its been buggin me all day =D

May sound dim but where do i enter:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery "qryBikes"
.
im new to this indepth access coding, gone are the days of simple flat fiel database and simple sort query....!
Sep 19 '07 #5
BradHodge
166 Recognized Expert New Member
No worries at all. Put the form that contains your combo box in design view. Then double click your combo box to open it's properties. Go to the Event Tab. On the After Update line, choose [Event Procedure], and then click the ellipsis out beside the line. This will take you to the Visual Basic Editor and will give you Private Sub..._AfterUpd ate( ) and End Sub. Between that, put your DoCmd.OpenQuery "YourQueryName" .

Once you have that, close the visual basic editor and then reopen your form normally, and try your combo box.

There are other things that you can do to the code to handle errors, etc, but this will at least get you going.

Let me know how it goes.

Brad.
Sep 20 '07 #6
mezmerize
6 New Member
No worries at all. Put the form that contains your combo box in design view. Then double click your combo box to open it's properties. Go to the Event Tab. On the After Update line, choose [Event Procedure], and then click the ellipsis out beside the line. This will take you to the Visual Basic Editor and will give you Private Sub..._AfterUpd ate( ) and End Sub. Between that, put your DoCmd.OpenQuery "YourQueryName" .

Once you have that, close the visual basic editor and then reopen your form normally, and try your combo box.

There are other things that you can do to the code to handle errors, etc, but this will at least get you going.

Let me know how it goes.

Brad.
i've followed what you said however when ever i update the combo box the query appears blank even though in the table of motrocycles i have; for example 3 "Yamaha" make bikes in the table, any clue to why this is would be a help.

thanks in advance and cheers for all the help.

Benn
Sep 20 '07 #7
BradHodge
166 Recognized Expert New Member
i've followed what you said however when ever i update the combo box the query appears blank even though in the table of motrocycles i have; for example 3 "Yamaha" make bikes in the table, any clue to why this is would be a help.

thanks in advance and cheers for all the help.

Benn
Hey Benn,

What specifically is the row source of your Combo Box? In case you're not sure how to tell... 1) Open your form in design view. 2) Double click on your combo box to get properties. 3) Click on the Data tab, and look at the row source. If you can, copy the entire line and send it back.


Brad.
Sep 21 '07 #8
mezmerize
6 New Member
Hey Benn,

What specifically is the row source of your Combo Box? In case you're not sure how to tell... 1) Open your form in design view. 2) Double click on your combo box to get properties. 3) Click on the Data tab, and look at the row source. If you can, copy the entire line and send it back.


Brad.
Row source:
Expand|Select|Wrap|Line Numbers
  1. SELECT [tbl_motorcycles (stock)].[Registration No], [tbl_motorcycles (stock)].[Make] FROM [tbl_motorcycles (stock)];
Sep 22 '07 #9
BradHodge
166 Recognized Expert New Member
Row source:
Expand|Select|Wrap|Line Numbers
  1. SELECT [tbl_motorcycles (stock)].[Registration No], [tbl_motorcycles (stock)].[Make] FROM [tbl_motorcycles (stock)];
Benn,

Check to make sure that your combo box has 2 columns visible with the Bound Column set to column 2 (as this should be your "Make" column). Also, make sure that your query has this criteria in the Make column... Forms![YOURFORMNAME]![YOURCOMBOBOXNAM E] . When you select from the combo box, your query should then open with the make of bike you chose.

If that doesn't work, let me know, I've got some other trouble shooting thoughts.

Brad.
Sep 23 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7546
by: MX1 | last post by:
I'm ready to pull the hair out of my head. I have a query with a couple of parameters that I want to get from combo boxes on a form. One parameter is a date with a dynamically calculated year and the other is criteria for a Yes or No field. I'll focus on the Yes/No field for simplicity. If I run the query with the criteria hard coded as either "YES" or "NO", it works. In the values of the combo box in my form, I have it set as...
6
2765
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 interest3 my combo box would be a dropdown containing these choices:
4
2064
by: d.p. | last post by:
Hi all, I'm using MS Access 2003. Bare with me on this description....here's the situation: Imagine insurance, and working out premiums for different insured properties. The rates for calculating premiums are dependant on the country in which the client is in. Therefore, we have a Country table, with its list of rates, a client table and then the property table. Getting this is great, works fine, easy! Problem is, now I need to work out a...
4
3518
by: Theo Jansen | last post by:
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
3
10335
by: Erwin Bormans | last post by:
Hello I want to make a parameter query where i can select the parameter out of a drop down box instead of typing the parameter in a text box. For example: if i have customers and want to run a query that gives me all the custormers from a chosen state, that i can choose the state in a drop down list instead of knowing it by heart and typing it myself. Does anybody has an idea or example for such a query?
0
4794
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 manually inserted a row in the table bound to the Combo box. The InsertAt Method of adding a row just does not work. Hope this helps anyone with this problem. john
2
2409
by: Glyn | last post by:
Hi All, Access 2000 SR1 Windows XP SP2 Word 2000 I have a button on a form (frmMainMenu) that calls a second form (frmContractPrint). In the second form is a combo box (cboContractNumber) and the user selects a contract number from the list. The combo box list is used in a query, which in turn is used to
6
12466
by: fieldja | last post by:
I have a form called OwnerForm. It contains a combo box called Owner. The combo box looks up names from a table called OwnerName. It contains fields called OwnerID and Owner. I also have a main form called ProjectsForm. This form has several fields to enter data. I have a query that is called Owner Query. This query contains the fields IDNumber.Projects2 Team.Projects2 and Owner.OwnerName getting information from tables. On the...
20
5217
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to write the parameter, I want to select a row from the listbox and after clicking in a button, the query to automatically take the current value of listbox as the needed parameter and then to load the query. (The Inputbox for "Enter Parameter" will...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8612
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.