Single and Double Quote marks

T

Thomas Kroljic

I have an application that stores the length of objects in a database table
such as:

Grand 5' 8"

In the past, I've been able to handle single quote marks when using VBA to
manipulate the data or do searches. Now that users are entering information
containing both single and double quote marks, my code is causing an error.
In the past here is what I've used:

for single quotes ----> myVar = """ & fieldname & """"

but once I hit a data element with both the single and double quote mark,
this code errors.

Any thoughts on how to handle both?

Thank you,
Thomas J. Kroljic
 
M

Marshall Barton

Thomas said:
I have an application that stores the length of objects in a database table
such as:

Grand 5' 8"

In the past, I've been able to handle single quote marks when using VBA to
manipulate the data or do searches. Now that users are entering information
containing both single and double quote marks, my code is causing an error.
In the past here is what I've used:

for single quotes ----> myVar = """ & fieldname & """"

but once I hit a data element with both the single and double quote mark,
this code errors.


You jave to double up on the quote marks you're using as the
delimiter. Change it to:

myVar = """ & Replace(fieldname, """", """""") & """"

but the shouldn't the first 3 quotes be 4 quotes instead?
 
T

Thomas Kroljic

Marshall,
Thanks for the response. I've been away from my computer for several
days. I'll give your suggestion a try.

Thomas j. Kroljic
 

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