473,756 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query influenced by combo box value

Hello,
I have a continuous form with a combo box inside. From the combo box I can
pick some values which, by the "after-update" event, change some other combo
box values determined by a query.
(i.e. I have some tree names and depending on what tree I pick on the other
combo box I can pick its fruits and other properties)

Now, mine is a continous form, and whenever I pick a value from the first
combo box the second one correctly shows the updated values, but the first
combo influences all records' combos in the form.
This way, following with my trees example, if I change the third tree all
combo boxes with properties for other trees change showing properties
related to this tree.

This is the query of the second combo box that depends on the first one
(IDTree):

SELECT DISTINCTROW TblProps.IDProp , TblProps.PropNa me, TblProps.IDTree FROM
TblProps WHERE (TblProps.IDTre e=CurrentRecord .IDTree.value)

What am I doing wrong?

Thanks in advance,
G
Nov 12 '05 #1
4 2999
I have a listbox with 13 columns in it, the bound column being column
1. I want to query a table with the list of values in the bound column
being used as the criteria. It doesn't matter to me if anything is
selected, I just want the entire list of values from the bound column.

I know I could do this looping through the listbox, but I'd rather
avoid that.

I'm thinking something like this:

"SELECT * FROM tblCustomers WHERE CustomerID IN " &[list of values
from bound column] & ""

the customerid is stored as a long int

Is it possible? Is there another way to do what I want without looping
through the listbox?
Any help would be really appreciated.

thank you

Nov 12 '05 #2
DFS
"arejay" <ar*******@yaho o.com> wrote in message
news:gr******** *************** *********@4ax.c om...
I have a listbox with 13 columns in it, the bound column being column
1. I want to query a table with the list of values in the bound column
being used as the criteria. It doesn't matter to me if anything is
selected, I just want the entire list of values from the bound column.

I know I could do this looping through the listbox, but I'd rather
avoid that.

I'm thinking something like this:

"SELECT * FROM tblCustomers WHERE CustomerID IN " &[list of values
from bound column] & ""

arejay,

Do you mean the value in the bound column from every row in the listbox? as
in SELECT * FROM TABLE WHERE CustomerID = 1 or CustomerID = 2 or CustomerID
= 3.... (where 1,2 and 3 are found in the bound column in the listbox)?

If that's the case, save the listbox rowsource as a query (if it's not
already) and use it in another query, something like:

SELECT T.*
FROM TABLE T INNER JOIN listBoxQuery Q
ON T.CustomerID = Q.CustomerID;
the customerid is stored as a long int

Is it possible? Is there another way to do what I want without looping
through the listbox?
Any help would be really appreciated.

thank you

Nov 12 '05 #3
arejay <ar*******@yaho o.com> wrote in message news:<gr******* *************** **********@4ax. com>...
I have a listbox with 13 columns in it, the bound column being column
1. I want to query a table with the list of values in the bound column
being used as the criteria. It doesn't matter to me if anything is
selected, I just want the entire list of values from the bound column.

I know I could do this looping through the listbox, but I'd rather
avoid that.

Yeah, I'd like to make lots of money, but I'd rather not work. Umm...
Wake up, you're dreaming. That's the ONLY way to get all the values
from a listbox, well, if your MultiSelect property is set to True.
There's code at www.mvps.org/access that will loop through the
listbox... and you'll have to build the SQL on the fly. Maybe create
a function to concatenate the items in the Selected collection of the
listbox and then use that.
Nov 12 '05 #4
DFS

"Pieter Linden" <pi********@hot mail.com> wrote in message
news:bf******** *************** **@posting.goog le.com...
arejay <ar*******@yaho o.com> wrote in message news:<gr******* *************** **********@4ax. com>...
I have a listbox with 13 columns in it, the bound column being column
1. I want to query a table with the list of values in the bound column
being used as the criteria. It doesn't matter to me if anything is
selected, I just want the entire list of values from the bound column.

I know I could do this looping through the listbox, but I'd rather
avoid that.

Yeah, I'd like to make lots of money, but I'd rather not work. Umm...
Wake up, you're dreaming. That's the ONLY way to get all the values
from a listbox, well, if your MultiSelect property is set to True.


It's always a bad idea to say ONLY or ALWAYS (a little recursive
disclaimer..)

If the listbox has a query for a rowsource, you can get the values from the
query. Maybe you misread - he doesn't say they have to be selected, just in
the list.


There's code at www.mvps.org/access that will loop through the
listbox... and you'll have to build the SQL on the fly. Maybe create
a function to concatenate the items in the Selected collection of the
listbox and then use that.

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7001
by: Gx | last post by:
I have this form with the fields: * Product: (drop down combo box) with choices - X, Y * Amount: (currency ) * Balance (currency) I want to associate product X with the percentage amount of 50 %, Y with 10
1
518
by: Giulio | last post by:
Hello, I have a continuous form with a combo box inside. From the combo box I can pick some values which, by the "after-update" event, change some other combo box values determined by a query. (i.e. I have some tree names and depending on what tree I pick on the other combo box I can pick its fruits and other properties) Now, mine is a continous form, and whenever I pick a value from the first combo box the second one correctly shows...
3
7550
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...
0
1314
by: Scott Morford | last post by:
This is a followup to a question I posed last summer. http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&selm=3f451dd4%240%241095%247f8943f3%40newsreader.visi.com I'm developing a weed management database to track our weed management practices in the eventual hope of using some statistical models on the data to measure outcome\success. The database contains principally two tables. One table contains static information such as an...
5
2144
by: Rated R1 | last post by:
I wrote this before in the NGs, so I am going to paste the responses that I got and see if someone can please help me. Email me and we can set something up as Id even be willing to pay for your time to get me to learn this procedure: MY ORIGINAL POST: I am trying to create a database for my small business. I have typed a bunch of information in a table in 5 columns (style, mm, karat, quantity, labor cost). We have different labor...
4
7192
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2) how to use the selection "All" as criteria for a field in a query, which is used to generate data for a report.
2
41295
by: | last post by:
Hi everyone, I have a form with a combo box on it. When you select a value (a PO#) from the combo box, the bound field is the indexID of the selected PO. On the same form, I have a text box that I'd like to feed from a query I've built. The query does some math and comes up with a number (qty allocated) for the selected PO. There are two tricky parts here. That query I've built needs to filter on the indexID that gets selected from...
5
3702
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and just choose the appropriate criterias from the combo boxes to get the results. I also want the query to run even if there is not a value in all the combo boxes ie., i want just all males with income level of over $100,000...Any insights or help...
1
1379
by: Jim | last post by:
I have a form with a combo that is linked to another query. It's my way of getting a value that I need displayed on the form. Only problem is the value isn't there until I select the combo manually. How can i get this value to show up in the combo box automatically. The query is tied to date parameters on the form but the form has no record source of its own.
20
5243
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
9455
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9271
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
10031
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...
1
7242
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
6534
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
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
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.