Multi field search-box

That's very interesting MajP. You forced me down another rabbit hole. Didn't know there was an ANSI type database but you are correct. How did you determine this out of curiosity?
Edit: Nevermind, I seen your other post on this.
 
Last edited:
Great job. YourThanks for help.
Here is the solution

HOWEVER, there is something in here I had no idea about. Either on purpose or accident your database is in ANSI mode. So the filter is not

Like '*Text*'
but
Alike '%Text%'

You need to determine if that is what you really want. This may be a regional setting thing or comparability with SQL server.

your code is work what I wanted. But I afraid for MODE ANSI, If i lost my data.
 
If you did not intend for ANSI 92 then you can change it to 89 by
  1. Click File > Options.
    The Access Options dialog box appears.
  2. Click Object Designers, and in the Query design section, under SQL Server Compatible Syntax (ANSI 92), do one of the following:
    • Select This database to change the open database to the ANSI-92 standard.
      -or-
      Clear the check box to set the open database to the ANSI-89 standard.
    • Select Default for new databases to set all new databases created with the open instance of Access to the ANSI-92 standard.
      -or-
      Clear the check box to set all new databases to the ANSI-89 standard.
  3. Click OK.
Top of Page

Then change the strval line of code.

Code:
'If you do not want ANSI 92 wildcards then use below line of code and change settings to 89
  'strVal = "LIKE '*" & Me.txtSearchbox.Text & "*'"
  'This is using ANSI 92 mode
  strVal = "ALIKE '%" & Me.txtSearchbox.Text & "%'"
 
If you did not intend for ANSI 92 then you can change it to 89 by


Then change the strval line of code.

Code:
'If you do not want ANSI 92 wildcards then use below line of code and change settings to 89
  'strVal = "LIKE '*" & Me.txtSearchbox.Text & "*'"
  'This is using ANSI 92 mode
  strVal = "ALIKE '%" & Me.txtSearchbox.Text & "%'"

YES, i was changed strVal = "LIKE '*" & Me.txtSearchbox.Text & "*'" and change object designers options ....
Its greats! Thank you so much MajP and others......
 

Users who are viewing this thread

Back
Top Bottom