Query to get a specific code within field

M

MaryF

Hello,

I am trying to extract data using a query. I need to pull only those
records where the second character equals the letter "P" (ie. GP17X)

How do I write that in the Criteria: field? I tried, like *P* but it
brought up codes that also have "P" in the fourth character (ie. M2TP3).

Can anyone please help me?

Thank you very much,
Mary
 
M

MGFoster

MaryF said:
Hello,

I am trying to extract data using a query. I need to pull only those
records where the second character equals the letter "P" (ie. GP17X)

How do I write that in the Criteria: field? I tried, like *P* but it
brought up codes that also have "P" in the fourth character (ie. M2TP3).

Can anyone please help me?

Thank you very much,
Mary


column_name LIKE "?P*"

? = only 1 character
* = 1 or more characters
 
S

SteveS

MaryF said:
Hello,

I am trying to extract data using a query. I need to pull only those
records where the second character equals the letter "P" (ie. GP17X)

How do I write that in the Criteria: field? I tried, like *P* but it
brought up codes that also have "P" in the fourth character (ie. M2TP3).

Can anyone please help me?

Thank you very much,
Mary

Try:

Mid([FieldName],2,1)="P"

Change [FieldName] to your field name

SteveS
 
M

MaryF

Thank you MG, that worked perfectly: Like "?P*"
Steve, thank you for your response, but I was unable to get that to work.

Thank you,
Mary
 
Top