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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating a List Box from a Combo Box

Status
Not open for further replies.

randaj

MIS
Jan 7, 2003
34
US
How is this done?
 
what exactly are you trying to do? what have you tried so far? have you searched KEYWORD help here in the forum, or read any HELP or texts about your issue? what's worked and what hasn't?
 
So here is what I have. I setup a cbo that lists all the users and then a lbo that will be populated by dates.

How should the query be setup? I setup two because when I Grouped the users I had multiple entries because of multiple dates. Then I setup another that looked for the cbo on the form and then that is where the date comes in.
 
so what are you trying to do?

you pick a user from the combo box, and there's some table that has Users and Dates (dates for what?) in it, and you want to display the dates in the list box based on which user is picked in the combo box?

why a list box? will you then be choosing dates from this list and doing something with them?

what is your table structure? (i.e. table name and fields). do you have a table called Users or something which has just one record per user? what is the combo box based on?

maybe if you give The Big Picture of what you are trying to do we'll know for sure we are going in the right direction.

thanks--g
 
The table is pretty simple. The fields are Name, Date, Idea 1,2,3, and 4. I want to setup a form that allows the end user to select the user and then select which record he wants. I figured the best way to choose the specific record was by date since the Idea fields are longs. After they highlight the date(record) they want in the lbo, that record would spit out in a report.
 
1. make a combo box, called cboNames. the rowsource is
(fill in your table name for the word NameIdeas):

Code:
SELECT DISTINCTROW NameIdeas.Name FROM NameIdeas GROUP BY NameIdeas.Name ORDER BY NameIdeas.Name;[code]

2. put a list box on the form. name it lstDates.
it's rowsource is:
[code]SELECT DISTINCTROW NameIdeas.Name, NameIdeas.Date, NameIdeas.Idea1, NameIdeas.Idea2, NameIdeas.Idea3, NameIdeas.Idea4 FROM NameIdeas WHERE (((NameIdeas.Name)=[forms]![Ideas]![cboName]));

3. in the combo box's OnChange event, put an Event Procedure:
Code:
Private Sub cboName_Change()
Me.lstDates.Requery
End Sub

tweak field names in #2. works fine for me. hope this helps.
g

 
Sweet! I was hoping it was something simple. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top