
Wildcard programming help required
I'm not sure what your question is. My guess is that you want to know how
force the combo box to display only matching classes if the text box is not
empty, or to display all classes if the text box is empty.
You can do this by first setting up the combo box with a default row source
that displays all classes -- something like this:
SELECT ClassCode, ClassDescription FROM tblClasses;
and then changing the rowsource whenever the text box is updated, like this:
Private Sub txtClassFilter_AfterUpdate()
If Len(Me!txtClassFilter & "") > 0 Then
Me!cboClass.RowSource = _
"SELECT ClassCode, ClassDescription FROM tblClasses " & _
"WHERE ClassCode Like '" & Me!txtClassFilter & "';"
Else
Me!cboClass.RowSource = _
"SELECT ClassCode, ClassDescription FROM tblClasses;"
End If
End Sub
Is this the sort of thing you were looking for?
--
Dirk Goldgar
(remove NOSPAM from reply address)
Quote:
> Hi - I work in a sports academy which codes its classes using 5
> characters. (a-z a-z 0-9 0-9 0-9) A typical class codes is fp216,
> which is interpreted as Fall session, Parent & Tot, running on Tuesday,
> class #16.
> I need to design a form having a textbox which supports both * (any
> number of characters) and ? (one character) wildcards. Entering fp*,
> for example, would cause all Fall Parent & Tot classes to be listed in
> the adjacent combobox. I need to be able to handle entries like
> fp*, w?4*, s?4?6, u*76, *4??.
> I've spent a long time on this, but this calls for a better programmer
> than me! I'd be grateful for any help. Brian D.