Trying to check 3rd character in string as criteria

  • Thread starter Thread starter Duane Hookom
  • Start date Start date
Dear R:

Simply:

Mid([text], 3, 1) = "Z"

The 3rd parameter of the Mid function is the length of the portion of
the string to extract. You want to look at only one character, I
believe.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
It should be:

Mid$(text,3,1)

Which means: in the variable "text," starting at the 3 character,
return 1 character.
 
I have a constant string length in a field, but for some reason all my
fiddling around with the Left, Left$, Mid, and Right functions are not
working.

Let's say I have a field named "text". Every record is 12 characters long.
I'm trying to query for every record where the third character is Z.

What I've tried:

Mid([text],3,3)="Z"

Mid([text],3,4)="Z"

Mid([TableName]![text],3,4)="Z"

All of these I've put in the "Criteria" cell of the field "text" in the
query builder.

And several other attempts with Left, which didn't seem to be the right
function to use.

I DO have data matching the criteria in here, but I get no errors and zero
records returned.

I would also like to be able to check for values in consecutive places, like
checking for the 3rd and 4th characters being "ZZ" or "ZA", etc.

Any help would be appreciated, and thanks.

Using Access 2000
 
Back
Top