Filter by form woes

G

Guest

I tried posting something like this already but am still flummoxed. I got
most of the following code from this forum but it doesn't work for me. I
have an unbound combobox on a form bound to a table. The user gets to select
a value from the combobox and the items in the combobox are the first three
letters of one or more of the records in the table. So, once the choice is
made, I would like the user to be able to move through a recordset restricted
(in the first three charcters) by their choice.

Private Sub cboChooseRecords_AfterUpdate()
'MsgBox (cboChooseRecords.Value)
If Me.Dirty Then 'Save before filter
Me.Dirty = False
End If

With Me.cboChooseRecords

If (.Value = 9) Then 'nothing entered: show all.

Me.FilterOn = False
Else
'MsgBox (Me!screenID)
MsgBox (cboChooseRecords.Column(1))
'screenname is the name of the control that will show the filtered
results
' four single place wildcards since the first three match the value
chosen in the combobox
Me.Filter = "[screenID] Like ""cboChooseRecords.Column(1)" & "????"""
Me.FilterOn = True
End If
Me.Detail.Visible = True
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top