DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP (http://www.daniweb.com/forums/forum62.html)
-   -   Constructing an A href link in CDO (http://www.daniweb.com/forums/thread200003.html)

whisper_101 Jun 26th, 2009 1:04 pm
Constructing an A href link in CDO
 
Hi Guys

I am trying to send a link in an email to my users - I am using CDO. I am having trouble contructing the link. Currently I am receiving the message "syntax error".

strBody = strBody & <a name= & "anchor" & id= & (rsEmailAlert.Fields.Item("S_Id").value) &  href= & " http://www.hair-salons.com/Hair-Salon-Search.asp" & > & "CLICK HERE" & </a> & vbCrLf

Any help would be great:)

jsvanc Jun 29th, 2009 3:16 pm
Re: Constructing an A href link in CDO
 
Quote:

Originally Posted by whisper_101 (Post 900895)
Hi Guys

strBody = strBody & <a name= & "anchor" & id= & (rsEmailAlert.Fields.Item("S_Id").value) &  href= & " http://www.hair-salons.com/Hair-Salon-Search.asp" & > & "CLICK HERE" & </a> & vbCrLf

Any help would be great:)

Your Code should look like this:
strBody = strBody & "<a name=" & anchor & " id=" & (rsEmailAlert.Fields.Item("S_Id").value) & " href='http://www.hair-salons.com/Hair-Salon-Search.asp'>Click Here</a>" & vbCrLf

This should work. Let me know if it doesn't.

whisper_101 Jun 29th, 2009 8:11 pm
Re: Constructing an A href link in CDO
 
Hi

Thanks for your reply.

The email is sent ok but the link appears like this:

<a name= id=1 href='http://www.hair-salons.com/Hair-Salon-Search.asp'>Click Here</a>

At the moment the <a name> is empty and I was hoping the link might appear in the email like this:

Click Here

..

jsvanc Jun 30th, 2009 2:06 am
Re: Constructing an A href link in CDO
 
It sounds like you are sending mail using text format. Make sure that you include this in your script:

myMail.BodyFormat = 0 
myMail.MailFormat = 0

Also, is the name supposed to equal "anchor" or is "anchor" a variable that should = something else?

If name=anchor then use this code:

strBody = strBody & "<a name='anchor'  id='" & (rsEmailAlert.Fields.Item("S_Id").value) & "' href='http://www.hair-salons.com/Hair-Salon-Search.asp'>Click Here</a>" & vbCrLf

Hope this helps.

whisper_101 Jun 30th, 2009 11:45 am
Re: Constructing an A href link in CDO
 
Works well - Thanks for all your help.


All times are GMT -4. The time now is 8:18 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC