Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate ListBoxes from two fields of a table.

Status
Not open for further replies.

PALman

Technical User
May 15, 2002
160
0
0
GB
I wish to populate a ListBox1 with the field values of a Field named "Specification" from an Access Table named "CustomerSpecs".
The next part I have already set up and works to transfer selections from ListBox1 over to ListBox2.
The last part is, for me more difficult, where I need to create a third ListBox3 and have it display another field value of same table, this time field name is Scope.
All connections/recordset to Access Database/Tables are in place.
The aim is to allow the user to select a number of customer specifications and as he does so the funtionality or scope of each is displayed in a list.
Any help would be greatly appreciated
Seasons Greetings to all!
 
Code:
Dim Spec

Do While Not RS.EOF
Spec=RS("Specification").Value
List1.AddItem Spec

RS.Movenext
Loop

HTH

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Thanks Ron Repp,
That's what I was looking for. However now I see the program running I have just hit on another requirement. I need to have the code bound or connected to the data on the form. i.e. when I move from one record with a different customer displayed in the customer field the the code lists a different set of specifications.
At present I am trying the code in various areas like under Form (This runs ok but if critera is true of first record but does not change when record changes). I have tried it under datPrimaryRS without success.
Any help as always is much appreciated
Thanks
 
Sounds like you're saying that you need to list a subset of the recordset. If so, apply a filter to the recordset (RS.Filter = "valid sql WHERE clause") and refresh.
 
Thanks Bob,
I shall try RS.Filter when I return to machine which will probably be tomorrow (Saturday).
Seasons Greetings to ALL!
 
FYI, I generally bind by hand, meaning I basically clear the list box and repopulate it using RonRepp's technique. I haven't found it to be noticeably slow.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top