Can't figure out the syntax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Standard sort of thing: I need to have a user choose a value from a combo
box, which choice filters the records the form will show giving a user access
only to those passing through the filter.

In my form, fields other than the combobox filter are bound to a query. The
entries in the combo box represent the first three characters of the
corresponding entry in the table (query). So the user sees BCA in the
droplist and, choosing that, expects to get all of the following: BCABB01,
BCADA29, BCAAA14 and so on (but not BBBAA01 etc).

Private Sub Combo2_AfterUpdate()

If Me.Dirty Then 'Save before filter
Me.Dirty = False
End If

With Me.Combo2
If IsNull(.Value) Then 'nothing entered: show all.
Me.FilterOn = False
Else
'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 = "[screenname] Like ""combo2.Value & "???? """"
Me.FilterOn = True
End If
End With
End Sub



Here's my code but I can't get the syntax right. If you do answer and the
problem is syntax, could you be so kind as to explain the syntax you use
(particularly the use of quotation marks: I'm not getting it)
 
Back
Top