JP-
We've got something that kinda does that. With a form that pops up with
three controls, a user is able to select from a list that populates based on
a prior selection. Essentially, the values of the second combobox are
populated based on the selection made in the first combo box:
ProjectTypeComboBox (gets project types from an existing SQL query)
ProjectNameComboBox (gets values based on what ProjectTypeComboBox is)
CommandButton (for running it all in the end)
----------------------------------------------------------------------------------------------
for the ProjectNameComboBox, we put an [Event Procedure] in it's "After
Update" Event. this, of course opens the VB scripting app. here is our code
for that procedure:
Private Sub ProjectTypeCombo_AfterUpdate()
Dim strSQL As String
strSQL = ProjectTypeCombo.Value
If strSQL = "Ship" Then
ProjectCombo.RowSourceType = "Table/Query"
ProjectCombo.RowSource = "Q-Ships"
ProjectCombo.BoundColumn = 1
End If
If strSQL = "Show" Then
ProjectCombo.RowSourceType = "Table/Query"
ProjectCombo.RowSource = "Q-Shows"
ProjectCombo.BoundColumn = 1
End If
If strSQL = "Project" Then
ProjectCombo.RowSourceType = "Table/Query"
ProjectCombo.RowSource = "Q-Projects"
ProjectCombo.BoundColumn = 1
End If
If strSQL = "Other" Then
ProjectCombo.RowSourceType = "Table/Query"
ProjectCombo.RowSource = "Q-Other"
ProjectCombo.BoundColumn = 1
End If
End Sub
------------------------------------------------------------------------------------------------
my CommandButton runs this procedure OnClick:
Private Sub Go_SearchProjects_Click() '<-- my commandButton
Dim SQLString As String
Dim TextObj As String
TextObj = ProjectCombo.Value
TextObj = Trim(TextObj)
SQLString = "ProjectName =" & " '" & TextObj & "'"
DoCmd.OpenForm "F-Projects", , , SQLString
End Sub