Display query results in Email body as hyperlink (1 Viewer)

jco23

Registered User.
Local time
Yesterday, 21:47
Joined
Jun 2, 2015
Messages
58
I have working code to generate e-mails and display query results in the body of an email message. However, I'd like those results to contain unique hyperlinks.

For example:

PortfolioName
port1
port2
port3
port4

Ideally, I'd like to have each of those names be embeded with a hyperlink (e.g. "mylink" & port1). if this is not possible, then I'm fine displaying the full html path, but I'd like that path to by hyperlinked.

as of now, the results get displayed in a table format as I am using this code:
DoCmd.OutputTo acOutputQuery, "qry_portfolios", acFormatHTML, "QueryResults.html"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("QueryResults.html", ForReading)
RTFBody = f.ReadAll
f.Close

I then source the RTFBody within the message body.

so my question is how can I get the results to be embeded with a hyperlink?

thanks!
 
Just a guess but you could try modifying your query to produce a hyperlink before outputting it to a file.
 
Just a guess but you could try modifying your query to produce a hyperlink before outputting it to a file.
yeah, I tried that, but it still will not display as a hyperlink when in the email message (despite being in HTML format)
 
yeah, I tried that, but it still will not display as a hyperlink when in the email message (despite being in HTML format)
HTML tags only work if the email client converts them into HTML. Is your email client set to display HTML pages?
 
HTML tags only work if the email client converts them into HTML. Is your email client set to display HTML pages?
yes. i realized that after I hit send, the recipient does see the address as a hyperlink, but I'd prefer to embed it within a shorter text.
 
yes. i realized that after I hit send, the recipient does see the address as a hyperlink, but I'd prefer to embed it within a shorter text.
Yes, you do that by crafting a proper html tag. For example: <a href="https://www.domain.com">Click here</a>
 
Yes, you do that by crafting a proper html tag. For example: <a hrefClick here</a>
right, I tried that within the query but to no avail. the text just displays the raw code and not embeded hyperlinked
 
right, I tried that within the query but to no avail. the text just displays the raw code and not embeded hyperlinked
As I said, the email client has to be able to display a proper html tag by setting it in the client itself. In other words, if I had a html file and opened it in Notepad, I would expect to see the raw tags. However, if I opened that same file in a web browser, then I should expect to see the tags as active links. The same goes with your email client (which you haven't mentioned which it is yet), it should be able to either work as Notepad or a web browser, depending on its capabilities.
 
As I said, the email client has to be able to display a proper html tag by setting it in the client itself. In other words, if I had a html file and opened it in Notepad, I would expect to see the raw tags. However, if I opened that same file in a web browser, then I should expect to see the tags as active links. The same goes with your email client (which you haven't mentioned which it is yet), it should be able to either work as Notepad or a web browser, depending on its capabilities.
I'm using Outlook.

I am able to embed links manually within an Outlook message, but if requires a settings change, then that may not work since I would need to have this fix applied to 500+ users.

but thanks for the responses!
 
I'm using Outlook.

I am able to embed links manually within an Outlook message, but if requires a settings change, then that may not work since I would need to have this fix applied to 500+ users.

but thanks for the responses!
Okay, now that I know it's Outlook, try using.HTMLBody instead of .RTFBody.
 

Users who are viewing this thread

Back
Top Bottom