Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Editing the value of the Query Criteria programmat

Author  Topic 

juno
Starting Member

11 Posts

Posted - 2003-09-24 : 10:04:18
I am not sure how to this. I have a table with two columns:

1 AAA
2 ABA
3 AAA
4 BBB

In my form I have two ListBox. In one of the ListBox I display “AAA, ABA” in a column format. What I am trying to do is: when the user picks on the AAA the second ListBox would display “1” and “2” in a ListBox format.

What I was thinking to do is to create a query that will filter ‘AAA’ form it’s original location and display everything filtered in the second ListBox.

What do you all think. Perhaps you know a better way to do this.

Also, if I decide to do it the way above, how would I go about feeding the ‘AAA’ into my Query programmatically?

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-09-24 : 10:17:07
for listbox1, the rowsource should be something like:

SELECT DISTINCT Col2 FROM YourTable ORDER BY Col2

Then, on the "On_Change" event (or maybe "after_update", there are pros and cons to each), you just need to programatically change the SELECT for the second list box:

ListBox1_OnChange()
ListBox2.rowsource = "SELECT Col1 FROM YourTABLE WHERE Col2 = '" & list1box.value & "' ORDER BY Col1"
ListBox2.Requery
End


something like that .

- Jeff
Go to Top of Page

juno
Starting Member

11 Posts

Posted - 2003-09-24 : 11:23:13
Thanks Jsmith8858, that was helpful.
Go to Top of Page
   

- Advertisement -