shabbaranks
Registered User.
- Local time
- Today, 10:27
- Joined
- Oct 17, 2011
- Messages
- 300
Hi guys,
Im currently pulling my hair out trying to overcome this one. I would like to populate a listbox based on an sql query which gets its record from a combo box...
Ok so the way Ive done it so far, my combo box is populated from a column in the table as per
And then "in thoery" my list box would requery based on the selection in the combo box as per
But the listbox isnt populating and if I press f5 I get the SELECT statement includes a reserved word or an argument name that is mispelled or missing, or the punctuation is incorrct.
Can anyone assist please? Thanks
Im currently pulling my hair out trying to overcome this one. I would like to populate a listbox based on an sql query which gets its record from a combo box...
Ok so the way Ive done it so far, my combo box is populated from a column in the table as per
Code:
Private Sub form_load()
Dim strSQL As String
strSQL = "SELECT [CompanyDetails].Company FROM CompanyDetails ORDER BY [CompanyDetails].Company; "
With Me![CompanyName_Combo]
.RowSource = strSQL
.Requery
End With
Me.CompanyName_Combo.SetFocus
End Sub
And then "in thoery" my list box would requery based on the selection in the combo box as per
Code:
Private Sub CompanyName_Combo_AfterUpdate()
Me.Results_listbox.RowSource = "SELECT CompanyDetails.Address1, CompanyDetails.Address2, CompanyDetails.Address3, CompanyDetails.Address4, " & _
"FROM [CompanyDetails] WHERE (CompanyDetails.Company) Like '*" & Me.CompanyName_Combo & "*' """
Me.Results_listbox.RowSourceType = "Table/Query"
Me.Results_listbox.Requery
End Sub
But the listbox isnt populating and if I press f5 I get the SELECT statement includes a reserved word or an argument name that is mispelled or missing, or the punctuation is incorrct.
Can anyone assist please? Thanks
