What I can't figure out is how to clear the Subtopic listbox when I launch the form and when I clear the Topic dropdown. I've experimented with a few things I found online but in the end, once I clear the listbox it won't repopulate the next time I select a Topic.
Here's the code I have so far:
Code: Select all
Private Sub cboFindTopic_AfterUpdate()
Dim sFilter As String
sFilter = "[Topic]= '" & Me.cboFindTopic & "'"
If IsNull(Me.cboFindTopic) Then
Me.FilterOn = False
Else
Me.Filter = sFilter
Me.FilterOn = True
End If
Me.lstSubtopics.Requery
End Sub
Private Sub cmdFilterOff_Click()
Me.FilterOn = False
Me.cboFindTopic = Null
End Sub
Private Sub lstSubTopics_AfterUpdate()
'===Converted from wizard generated macro
On Error GoTo lstSubTopics_AfterUpdate_Err
DoCmd.SearchForRecord , "", acFirst, "[InfoID] = " & Str(Nz(Screen.ActiveControl, 0))
lstSubTopics_AfterUpdate_Exit:
Exit Sub
lstSubTopics_AfterUpdate_Err:
MsgBox Error$
Resume lstSubTopics_AfterUpdate_Exit
End Sub
cboTopics
Code: Select all
SELECT tblInfoTopic.Topic FROM tblInfoTopic;
Code: Select all
SELECT tblGeneralInfo.InfoID, tblGeneralInfo.Subtopic, tblGeneralInfo.Topic
FROM tblGeneralInfo
WHERE (((tblGeneralInfo.Topic)=[Forms]![frmGeneralInfo]![Topic]));