Single and Double Quote marks

  • Thread starter Thread starter Thomas Kroljic
  • Start date Start date
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
 
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?
 
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
 
Back
Top