Query to get a specific code within field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 
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
 

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

Back
Top