473,505 Members | 13,696 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,models,colour,no.owners, 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 3075
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,models,colour,no.owners, 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..._AfterUpdate( ) 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..._AfterUpdate( ) 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]![YOURCOMBOBOXNAME] . 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
mezmerize
6 New Member
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]![YOURCOMBOBOXNAME] . 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.
Got it! for sum reason i had set it to look in bound column 1!
Cheers for all the help!

You don't know how much easier you've made my life. this is all for my AS level course work and it just makes validation in the testing section so much more simple to complete, 4 years of the systems life cycle based coursework using Microsoft Access and you think i would have mastered it!

Thanks for everything!

Benn
Sep 23 '07 #11
BradHodge
166 Recognized Expert New Member
Got it! for sum reason i had set it to look in bound column 1!
Cheers for all the help!

You don't know how much easier you've made my life. this is all for my AS level course work and it just makes validation in the testing section so much more simple to complete, 4 years of the systems life cycle based coursework using Microsoft Access and you think i would have mastered it!

Thanks for everything!

Benn
No problem.

When you set-up combo boxes like that, it will usually default to column 1 being the bound column (which can often be the primary key). You have to tell it to if you want it to look elsewhere.

Glad it's working for you.

Brad.
Sep 24 '07 #12

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

Similar topics

3
7537
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...
6
2750
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...
4
2053
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...
4
3509
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...
3
10327
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...
0
4779
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
2406
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)...
6
12453
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...
20
5185
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...
0
7213
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
7098
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...
0
7298
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
7366
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
5610
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,...
1
5026
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...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.