View Full Version : Search result based on the first letter of a field


Vav
09-29-2006, 11:40 AM
Hello,

I need to create a query that will seach through a column and only return a result with product codes starting with A.

An example of a product code is AA0000034567.... however there is no realy consistancy. Some start with the AA and some don't. Some have 5 zeros before the numbers start others may only have 1, 2, 3, or 4 zeros before the number.... There are approx 76,000 product codes in total.

My end goal is to create a query to find all the records that have a product code starting with A so that I can eventually delete the AA00000 portion of the code and strip the number back to the point where the 34567 starts.

I figured that by separating out the product codes that start with AA would be a good start.

If any one has any suggestions please let me know.

Peter Vav

CraigDolphin
09-29-2006, 11:46 AM
Use a criteria in the relevant query field
e.g., Like "A" & "*"

Vav
09-29-2006, 11:54 AM
Thanks for the advice.... but could you explain a little furhter.

I am fairly new to this.

Regards,

Peter Vav

Vav
09-29-2006, 12:03 PM
Thanks, I figured it out.... only the products starting with A's showed up all 50,000 of them

Seeing you are helping.... do you know where I would add in a Right Trim piece of code to trim off the digits after 6 characters....?

Ie,

AA0000000652618... I only want to be left with 652618.

Regards,

Peter Vav

CraigDolphin
09-29-2006, 12:12 PM
In an empty field of the same query, in the the field name enter this:
ShortCode: Right(YourCodeField,6)

and replace the bolded section with the name of the field that contains your full code string