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!

ComboBox controls Listbox

Status
Not open for further replies.

bill1one

Programmer
Sep 29, 2004
93
US
I have a combobox (cmbType). After it updates I want the listbox (lstResolution) to show the any records that match the value in cmbType.

I have an AfterUpdate event for cmbType that looks like this:

Private Sub cmbType_AfterUpdate()
Dim strNewRecord As String
strNewRecord = "SELECT [Number], [Type], [Description], [Date] FROM tblResolution " _
& " WHERE [Type] = '" _
& Me![cmbType] & "'"
Me.RecordSource = strNewRecord
End Sub

Why won't the listbox show the records that match the SQL statement?
 
How are ya bill1one . . . . .
[ol][li]Base the RowSource[blue][/blue] of the listbox on a query that [blue]includes criteria[/blue] for comparing [blue]cmbType[/blue] against the value in the combo.[/li]
[li]In the [blue]AfterUdate[/blue] event of the combo, Requery the Listbox.[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
Have a look at this thread702-1116937. I had a similar problem a week ago.


Pampers.

You're never too young to learn
 
Replace this:
Me.RecordSource = strNewRecord
By this:
Me![listbox name].RowSource = strNewRecord

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top