Change search code?

  • Thread starter Thread starter Harmannus
  • Start date Start date
H

Harmannus

Hallo,

How can i change the below searchcode to look through a whole field instead
of starting at the beginning. So search field combo3 has the value pink and
has to looks through the field colours containing designcolours, so some
contain pink and other don't.: e.g. field designcolours: Black, white, red,
green, pink, brown.

If Not Me!Combo3 = "" Then
If GetStrZoek = "" Then
GetStrZoek = "[Designcolours] Like " & Chr$(34) & Me!Combo3
Else
GetStrZoek = GetStrZoek & "AND [Designcolours] Like " & Chr$(34)
& Me!Combo3
End If
GetStrZoek = GetStrZoek & Chr$(34)
End If

thanx in advance for any help!

Regards,
Harmannus
 
Perhaps now you can see why you should not put multiple values in a field.
The search will be slow since it can't be indexed:

Like "*" & Me!Combo3 & "*"

Pluse any quotation marks you need to delineate your string search. The
above will find the contents of combo3 anywhere in the field.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Hallo Arvin,

Thanx for the advice and the help! I will consider a redisign ;-)

Regards, Harmannus



Arvin Meyer said:
Perhaps now you can see why you should not put multiple values in a field.
The search will be slow since it can't be indexed:

Like "*" & Me!Combo3 & "*"

Pluse any quotation marks you need to delineate your string search. The
above will find the contents of combo3 anywhere in the field.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Harmannus said:
Hallo,

How can i change the below searchcode to look through a whole field instead
of starting at the beginning. So search field combo3 has the value pink and
has to looks through the field colours containing designcolours, so some
contain pink and other don't.: e.g. field designcolours: Black, white, red,
green, pink, brown.

If Not Me!Combo3 = "" Then
If GetStrZoek = "" Then
GetStrZoek = "[Designcolours] Like " & Chr$(34) & Me!Combo3
Else
GetStrZoek = GetStrZoek & "AND [Designcolours] Like " & Chr$(34)
& Me!Combo3
End If
GetStrZoek = GetStrZoek & Chr$(34)
End If

thanx in advance for any help!

Regards,
Harmannus
 
Back
Top