Change search code?

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
 
A

Arvin Meyer

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
 
H

Harmannus

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top