Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Like statement, but as LEN 1

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
Is there any way to modify this like statement so that the like comparison includes finding a like where the LEN is the same as the search parameter?

Like [FORMS]![NameKeywordShot].[LD].[CAPTION]));

In this case, a like compared to the LEN of the caption of LD

Many thanks
 
You wanted something like this ?
WHERE Len(yourField) = Len([yourParam])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV. I tried the sql below, but it produced a chopped down output of the comments field.

Basically the query worked pretty fast in producing records containing a picked out word. It was quicker than previous queries I had worked on. The problem is, if I was looking for the word CAR, it produced records containing CARPARK etc. I thought there may have been a way to say produce a list of records that contain the word and its wordlength. Hope thats clear. Thanks
 
the like operator works as follows:

LIKE "CAR*"
finds all records where the field starts with the letters CAR:

CAR
CARPET
CARPARK

LIKE "*CAR"
finds all records where the field ends with the letters CAR
BOXCAR
SCAR
SIDECAR

LIKE "*CAR*"
finds all records that contain the letters CAR
CAR
CARPET
CARPARK
BOXCAR
SCAR
SIDECAR
APOTHECARY
APPLECART
BANKCARD







Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Many thanks Leslie. So thats it, back to working on previous queries. If only life was easier. Regards
 
Thanks Leslie. I read your excellent description of the like statement, and found if I put a leading space in my data, I got the actual word.

Me.LD.Caption = "*" & Me.Combo261.Text & " *"

Problerm solved, thanks again.
 
that's because it's looking for CAR[ ]* so it won't find words like CARPET since there's no space!
 
Thats it, and it did the trick. Many thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top