How do I find quotation marks in a string using INSTR? String exa.

G

Grandpa Bernie

If a string has a substring in quotes, how can I extract only the quoted
substring? Can it be done without writing code to loop through each
character in the string?
Example:
A field in a table has the value: Test Group: "NYS"; New York State
Assessment
I want to extract only the string in quotes: NYS

In particular, can this be done in a query using any combination of string
functions?
 
L

Larry

It can, but it's ugly:

Mid([field],InStr([field],"""")+1,InStr(InStr([field],"""")+1,[field],"""")-InStr([field],"""")-1)
 
L

LarryP

You might try using Chr(34) in your string searches rather than trying to
search for ", which kinda drives most functions/queries/SQL nuts.
 
Top