Using " in a string expresion

B

Biss

hi... Would like to use " a sting expression..

I have tried """ but doe not work..

This is what I have

html: "<option value=" & [ShortName] & ">" & [SiteName] & "</option>"

This is what I need

html: "<option value="" & [ShortName] & "">" & [SiteName] & "</option>"

However I have tried various things and still cant get the " to be places in the expression..

Thanks In Advance

Bob
 
B

Bob Barrows

Biss said:
hi... Would like to use " a sting expression..

I have tried """ but doe not work..

This is what I have

html: "<option value=" & [ShortName] & ">" & [SiteName] & "</option>"

This is what I need

html: "<option value="" & [ShortName] & "">" & [SiteName] &
"</option>"

However I have tried various things and still cant get the " to be
places in the expression..

Thanks In Advance

Bob

You escape quotes by doubling them, but I have to ask, why force the double
quotes? Single quotes are valid in html:
html: "<option value='" & [ShortName] & "'>" & [SiteName] & "</option>"

To force the double quotes, you need to do this:
html: "<option value=""" & [ShortName] & """>" & [SiteName] & "</option>"
 
J

John Spencer

Every place you want a quote you need to use two quotes in a Row.

Somestring = "html: ""<option value=""""" & [Shortname] & """"">" & [Sitename]
& """</Option>"""

Or use Chr(34) or a reference to it to put in the quote marks

SomeString = "html:" & Chr(34) & "<option Value=" & Chr(34) & Chr(34) &
[ShortName] & Chr(34) & Chr(34) & ">" & Chr(34) & [SiteName] & Chr(34) &
"</Option>"

You could define a variable as
Dim DQ as String: DQ=Chr(34)
and use that in place of Chr(34) in the above expression.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
B

Biss

Thanks John.. Worked like a charm

John Spencer said:
Every place you want a quote you need to use two quotes in a Row.

Somestring = "html: ""<option value=""""" & [Shortname] & """"">" &
[Sitename] & """</Option>"""

Or use Chr(34) or a reference to it to put in the quote marks

SomeString = "html:" & Chr(34) & "<option Value=" & Chr(34) & Chr(34) &
[ShortName] & Chr(34) & Chr(34) & ">" & Chr(34) & [SiteName] & Chr(34) &
"</Option>"

You could define a variable as
Dim DQ as String: DQ=Chr(34)
and use that in place of Chr(34) in the above expression.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
hi... Would like to use " a sting expression..

I have tried """ but doe not work..

This is what I have

html: "<option value=" & [ShortName] & ">" & [SiteName] & "</option>"

This is what I need

html: "<option value="" & [ShortName] & "">" & [SiteName] & "</option>"
However I have tried various things and still cant get the " to be
places in the expression..
Thanks In Advance
Bob
 
B

Biss

Thanks Bob

Works well

Bob Barrows said:
Biss said:
hi... Would like to use " a sting expression..

I have tried """ but doe not work..

This is what I have

html: "<option value=" & [ShortName] & ">" & [SiteName] & "</option>"

This is what I need

html: "<option value="" & [ShortName] & "">" & [SiteName] &
"</option>"

However I have tried various things and still cant get the " to be
places in the expression..

Thanks In Advance

Bob

You escape quotes by doubling them, but I have to ask, why force the
double quotes? Single quotes are valid in html:
html: "<option value='" & [ShortName] & "'>" & [SiteName] & "</option>"

To force the double quotes, you need to do this:
html: "<option value=""" & [ShortName] & """>" & [SiteName] & "</option>"




--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
 

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