Query for Like Records

margt_a

Registered User.
Local time
Today, 00:43
Joined
Aug 15, 2002
Messages
35
I have a text field that holds a location code in the format >LLL/-000. The letter and number parts refer to coordinates on a big map in our office. I would like to have the users able to search for similar records by either half based on the LocationCode value in the frmProject.

Do I need to use a Like function for this, or should I split up the contents of the text box and query them separately? Any input on this would be greatly appreciated.

Thanks!
Margaret.
 
From a purist standpoint, split the field into X-coordinate and Y-coordinate. Then the query becomes .... WHERE [XCoord] = "ABC" or [YCoord]=123.

But understand that I used a shortened syntax for this. From your description, this would be a piece-of-cake query for Access.

Even if you left the fields together, you could do

.... WHERE [MapCoord] Like "ABC/*" or [MapCoord] Like "*/123"

and again, I am glossing over syntax things to make this clearer in terms of its logic.
 
I must be missing something. I put the Where clause in a select subquery to retrieve location codes, and get either no results at all or a message that only one record can be returned.

The query should pick up the value of the record on the active form, compare it with similar records in the database, and return a list.

I split the field into two hidden text boxes on the main form (XCoord and YCoord) using a Mid expression, and I think the query references the form alright.

Thanks for your help!
 

Users who are viewing this thread

Back
Top Bottom