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

Selectively populating a Combo List 1

Status
Not open for further replies.

pauldt123

Technical User
Mar 23, 2006
21
GB
I have a 4 table layout; Answers, Teams, Project, Questions. Project is linked to Answers by Project ID, Teams is linked to Answers by Team ID (Answers has a composite key of Project ID and Team ID). Team ID is also the primary key for Questions and is linked to teams.

At present I have a main form in which the project is selected from a combo list, which in turn reveals another combo list containing all of the teams. Once a team is selected the relevant questions for that team are displayed. I need a form which enables me to selctively associate teams to each project, so when the Teams combo list is expanded on the main form, only the selected teams are visible and selectable.

Any assistance would be very gratefully received!
 
You can do this with a query or a SQL statement that you set in VBA code. One idea might be something like this (not necessarily exactly with your example, but same idea):

Code:
Private Sub CheckData()
  Dim strSQL As String
  strSQL = "SELECT x FROM MyTable " & _
           "WHERE x = '" & cmbComboBox1 & "'"
  cmbComboBox2.RowSource = strSQL
End Sub
 
Sorry for the delay in replying I've been distracted by about 100 different things. Your advice was extremely useful, I modified the SQL you suggested and it did the trick.

Thanks again

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top