Using "" in Code

M

Mike

I am querying a few fields in a DB table to get To, From, Subj,
Message, SMTP Server and Port Number info to use CDO to send a
preformatted message based on what is in this table.

All works well except on line.

MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= (rsEmailSettings.Fields.Item("NIDServer").Value)

If the table has MyServer.MyCompany.Com in it the output is:

MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= MyServer.MyCompany.Com

This does not work.

I need it to be:

MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "MyServer.MyCompany.Com"

Where MyServer.MyCompany.Com is enclosed in "".

I, for the life of me can't figure out how to write this line to do
it. Can someone give me some info on where to get the code or if you
know what I am missing, post it for me?

Thanks...

Mike...
 
D

Dave Anderson

Mike said:
If the table has MyServer.MyCompany.Com in it the output is:

MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= MyServer.MyCompany.Com

This does not work.

I need it to be:

MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "MyServer.MyCompany.Com"

Where MyServer.MyCompany.Com is enclosed in "".

In VBScript, you can escape quotes by doubling them. Thus, you want
something like this:

MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= ("""" & rsEmailSettings.Fields.Item("NIDServer").Value & """")


Likewise, in JScript:

MyMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= ("\"" + rsEmailSettings.Fields.Item("NIDServer").Value + "\"")
 

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

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top