G
Guest
I am attempting to populate my Listbox with data, based on a selection in a
combo box.
What I am finding is that the Listbox is being populated with the select
statement.
Obviously, I'm doing something wrong, just don't know what it is.
Should I also be putting some kind of code in the Form_Load event? I don't
think I should, because the contents of the Listbox won't be determined until
the after the combo box selection right?
Sample Code - For the after_update event of the combo box.
Private Sub cboBpr_AfterUpdate()
On Error Resume Next
cboBpr.SetFocus
Dim db As DAO.Database
Dim strSQL As String
Dim strWhere As String
Dim rs As DAO.Recordset
strWhere = "WHERE BPRNumber = '" & cboBpr & "'"
strSQL = "SELECT BPRNumber FROM tblBPRNumber" & strWhere
strSQL = strSQL & "ORDER BY BPRNumber;"
Me.txtArea = rs("Area")
Me.lstSops.RowSource = strSQL
End Sub
combo box.
What I am finding is that the Listbox is being populated with the select
statement.
Obviously, I'm doing something wrong, just don't know what it is.
Should I also be putting some kind of code in the Form_Load event? I don't
think I should, because the contents of the Listbox won't be determined until
the after the combo box selection right?
Sample Code - For the after_update event of the combo box.
Private Sub cboBpr_AfterUpdate()
On Error Resume Next
cboBpr.SetFocus
Dim db As DAO.Database
Dim strSQL As String
Dim strWhere As String
Dim rs As DAO.Recordset
strWhere = "WHERE BPRNumber = '" & cboBpr & "'"
strSQL = "SELECT BPRNumber FROM tblBPRNumber" & strWhere
strSQL = strSQL & "ORDER BY BPRNumber;"
Me.txtArea = rs("Area")
Me.lstSops.RowSource = strSQL
End Sub