Use 'Instr' to search through two fields

lundi 27 avril 2015

Hello everybody,

In my developing application I am making use of searchboxes to narrow down the amount of records. On a form I have a textbox and a subform with a table connected. In the textbox I can type a character that will be used in an 'Instr' SQL query. I am using the code to query one field. (see code below)

My question is: In what direction do I have to look to make this code usefull to search through two fields. In my case that will be Tag and Function.

Code:

Private Sub mnu3_txt_UnitbookSearch_Change()

  Dim SQLstring As String
  SQLstring = "Instr(Tag, " & "'" & Me.mnu3_txt_UnitbookSearch.Text & "'" & ")"
  ReReadDescriptions SQLstring

End Sub

Private Sub ReReadDescriptions(SQLtext As String)

  With Me!frmSUB_Unitbook.Form
    .Filter = SQLtext
    .FilterOn = True
    .Visible = True
    .Requery
  End With

End Sub

All help is appreciated with thanks in advance,
Rene
Use 'Instr' to search through two fields

0 commentaires:

Enregistrer un commentaire

Labels