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

G

Guest

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

Guest

It can, but it's ugly:

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

Guest

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

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

Top