473,396 Members | 1,725 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,396 software developers and data experts.

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.PropName, TblProps.IDTree FROM
TblProps WHERE (TblProps.IDTree=CurrentRecord.IDTree.value)

What am I doing wrong?

Thanks in advance,
G
Nov 12 '05 #1
4 2964
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*******@yahoo.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.

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*******@yahoo.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********@hotmail.com> wrote in message
news:bf*************************@posting.google.co m...
arejay <ar*******@yahoo.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
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...
1
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....
3
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...
0
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...
5
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...
4
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)...
2
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...
5
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...
1
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...
20
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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...
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,...

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.