Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 10th, 2003, 01:09 PM
mccjg mccjg is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Euless, TX
Posts: 6 mccjg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Need to email results of Access query in html

I am working on a simple log database for a coworker in my office. She has the need to pull records from an Access db and email them. I know there are various ways of doing this thru the menus in Access, but she would like to have the process automated as much as possible. So, I am stuck with the task of writing code to dynamically generate an email from the results of a query. By itself this is easy enough, but some of the information in the email needs to be hyperlinked to .pdf files on our servers and she does not want the whole path to the file displayed as the link. Is html my only option? If so how do I make Access generate html and copy/import that html as the body of an email in Outlook 2k? Are there any other solutions you can think of? Thanks for your time...

Forgot to add...a file should not be created for the html to be stored. Should one be neccessary(sp?) it should be deleted when it's no longer needed. I am a beginner with VB and a novice programmer so go easy if the answer is obvious.

Last edited by mccjg : July 10th, 2003 at 02:10 PM.

Reply With Quote
  #2  
Old July 10th, 2003, 07:22 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
damn you for bringing my work home

man, this is all i did last week is set up 5 autogenerated emails, haha, here it is

first I assume you posses the ability to connect to the db all on your own. Secondly, i use cdonts with vbscript, as long as you're not mass mailing it's ok, i hear it's inneficient and should be avoided if you are doing lots of emails with cdonts (hence the name, c donts


code

Function EmailCdonts(byval strAuthorEmail,byval strRecipientEmail,ByVal strCC, byval strSubject,byval strBody,
ByVal intMailFormat,ByVal strAttachmentPath,ByVal intPriority)

Dim ObjMail


Set ObjMail = Server.CreateObject("CDONTS.NewMail")
' don't put set if you're using aspx

ObjMail.FROM = strAuthorEmail
ObjMail.TO = strRecipientEmail
ObjMail.Cc = strCC

ObjMail.Subject = strSubject

ObjMail.BodyFormat = intMailFormat
ObjMail.MailFormat = intMailFormat
ObjMail.Body = strBody

' CdoHigh = 2 - Highest priority (Urgent)
' CdoNormal = 1 - Normal
' CdoLow = 0 - Lowest
ObjMail.Importance = intPriority


If strAttachmentPath <> "" Then
ObjMail.AttachFile strAttachmentPath
End If

ObjMail.Send

Set ObjMail= Nothing

End Function


see the bolded strSubject?

when you pass this string it, make this your html code, aka all your links will look like this
strSubject= "<a href=""http:\\www." & site & ".pdf"">click here to go there</a>"

just remember for a " in the string to do "", that one tripped me up alot

Last edited by unatratnag : July 10th, 2003 at 07:32 PM.

Reply With Quote
  #3  
Old July 10th, 2003, 07:29 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
oops

sorry, read your email again,

.BodyFormat Format of the message
0=Text (default)
1=HTML

you'll want HTML of course

Last edited by unatratnag : July 10th, 2003 at 07:32 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Need to email results of Access query in html


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway