MS Access Forum / General 1 / February 2006
how do u send an email using access?
|
|
Thread rating:  |
DP - 18 Feb 2006 17:49 GMT hi,
is there a way to send an e-mail to a customer, using ms access?? or some kind of automated mail merge, so the user only has to review the body, and click send?
ive got a customer table, with a field called email address, where the customer can have an e mail address.
is there a way to make access create one, using outlook express, or anything similar?? i just wanted to create some kind of reminder e mail, to say, please bring yor rented film back to the store.
does any1 know of any sites, advice?
TIA
dev
fredg - 18 Feb 2006 18:21 GMT > hi, > [quoted text clipped - 15 lines] > > dev DoCmd.SendObject acSendNoObject, , acFormatTXT, [EmailAddressField], , , "Item not returned", "Please return the film you have rented." & vbNewLine & "There is a late fee of $2.00 per day.", True
Look up the SendObject method in VBA help.
 Signature Fred Please respond only to this newsgroup. I do not reply to personal e-mail
Tim Marshall - 19 Feb 2006 00:21 GMT > DoCmd.SendObject acSendNoObject, , acFormatTXT, [EmailAddressField], , > , "Item not returned", "Please return the film you have rented." & > vbNewLine & "There is a late fee of $2.00 per day.", True One irritating thing the help file does not tell you is that sendobject DOES NOT WORK PROPERLY with netscape as the default mail client. It is unable to fill in the to header and unless you have the email generated so that you can physically add it in, it won't send a blinking thing.
This problem is with Access 2003 Sp2 and Netscape 7.2.
 Signature Tim http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Bernard Peek - 19 Feb 2006 13:04 GMT >> DoCmd.SendObject acSendNoObject, , acFormatTXT, [EmailAddressField], , >> , "Item not returned", "Please return the film you have rented." & [quoted text clipped - 6 lines] > >This problem is with Access 2003 Sp2 and Netscape 7.2. I've seen the same problem using Access 2000 and Turnpike as the mail client. I suspect that it may only work with Outlook.
 Signature Bernard Peek London, UK. DBA, Manager, Trainer & Author.
Fred Zuckerman - 20 Feb 2006 21:28 GMT > > DoCmd.SendObject acSendNoObject, , acFormatTXT, [EmailAddressField], , > > , "Item not returned", "Please return the film you have rented." & [quoted text clipped - 6 lines] > > This problem is with Access 2003 Sp2 and Netscape 7.2. Also, with A2K, make sure you are using SP-3. There were some SendObject bugs that MS fixed. Unfortunately for me, I have a client that bought a huge & expensive software package from a firm that evidently wrote it for MS Office SR-1. They claim that their warranty voids if they load any newer patches. Thus my client won't load SP-3 (for fear that their expensive software might crash) and thus my little A2K emailing project won't work for them. Instead, they've asked me to change my database to print a report and they will fax it daily to the 10 people that need it. How silly :( Fred Zuckerman
DP - 28 Feb 2006 14:43 GMT so,
how could i test if outlook express or outlook is on the computer??
so then, if iether one of them is, the email button will work, and load up the email message i've created?
thanx
devin
> > > DoCmd.SendObject acSendNoObject, , acFormatTXT, [EmailAddressField], , > > > , "Item not returned", "Please return the film you have rented." & [quoted text clipped - 21 lines] > they will fax it daily to the 10 people that need it. How silly :( > Fred Zuckerman james.igoe@gmail.com - 28 Feb 2006 15:42 GMT Like I said, it is designed for Outlook-assumed clients, but otherweise you might need to check the registry. Information can be found here:
http://www.insideoutlookexpress.com/files/regkeys.htm
Also, you might need to make sure that it was also setup and the default mail client.
I ran across this code that purports to work with everything, but does not do attachments:
'**Module (space formatting added to make it easier to read):
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'**Code attached to a button:
Dim stext As String
'Hard coded parts of the e-mail, stripped down to the minimum stext = "mailto:me@myaddress.co.nz?" stext = stext & "&Subject=" & "Document attached" stext = stext & "&Body=" & "Please find the document attached"
'Launch default e-mail Call ShellExecute(hwnd, "open", stext, vbNullString, vbNullString, SW_SHOWNORMAL)
DP - 19 Feb 2006 12:00 GMT hi,
i've put the code u gave me, and it all comes out in RED writing.
the email addess field is called EMailAddress which is in an overduefilmquery called qryOverdueFilmRentalQuery
the code u gave me seems correct, but there is some kind of systax error or something? if i can just get this email working, i can can add my own fields/data in it.
thanx
dev
> > hi, > > [quoted text clipped - 26 lines] > Please respond only to this newsgroup. > I do not reply to personal e-mail DP - 19 Feb 2006 12:07 GMT hi,
this is wat ive got so far;
Private Sub cmdFilmMail_Click()
DoCmd.SendObject _ , _ , _ , _ "ToJohn@doe.com", _ , _ , _ "Blockbuster Team - You have an Overdue Film Rental", _ "Dear Sir/Madem, You have an over film rental. Pleas could you return it to your nearest blockbuster store.", _ True
End Sub
is there a way to link the email address field, to a field in my query? as mentioned in the post before. also i want to do the same, with the name (after the dear bit) and state the 'FilmID' 'FilmTitle' from the metioned query, into the email message. the above code, opens an email message, ready to send. thanx
dev
> hi, > [quoted text clipped - 45 lines] > > Please respond only to this newsgroup. > > I do not reply to personal e-mail DP - 19 Feb 2006 15:17 GMT i sorted it, it it works perfectly!! damn i'm so good!!
thanx for all the help. :)
dev
> hi, > [quoted text clipped - 75 lines] > > > Please respond only to this newsgroup. > > > I do not reply to personal e-mail Bernard Peek - 20 Feb 2006 13:36 GMT >i sorted it, it it works perfectly!! damn i'm so good!! How?
 Signature Bernard Peek London, UK. DBA, Manager, Trainer & Author.
DP - 20 Feb 2006 16:24 GMT well it works if u have outlook express installed. i tried it on my m8s pc today, and some msn 'passport' screen loads up, and then crashes. (Cos he does not have outlook express)
is there anyway to check this? or to stop it from crashing?
i've got the code i'm using at the mo, if u want it?
thanx
devin
> >i sorted it, it it works perfectly!! damn i'm so good!! > [quoted text clipped - 3 lines] > Bernard Peek > London, UK. DBA, Manager, Trainer & Author. Bernard Peek - 24 Feb 2006 15:21 GMT >well it works if u have outlook express installed. i tried it on my m8s pc >today, and some msn 'passport' screen loads up, and then crashes. (Cos he [quoted text clipped - 3 lines] > >i've got the code i'm using at the mo, if u want it? Sure. Email it if it's too long to post.
The code I'm using builds the "message" by appending the to address & vbCrLf & Boilerplate. That leaves the email address as the first line of the message, I cut and paste it from there.
I'm told that there is an alternative method that involves building a mailto: URL, and that's reported to work with other mail clients. I'm not about to rewrite my code unless someone is paying me to. (Anyone in the UK looking for an IT Manager?)
 Signature Bernard Peek London, UK. DBA, Manager, Trainer & Author.
DP - 24 Feb 2006 15:56 GMT ok, its this;
Private Sub cmdFilmMail_Click()
DoCmd.SendObject _ , _ , _ , _ "Enter E-Mail address HERE", _ , _ , _ "Blockbuster Team - You have an Overdue Film Rental", _ " Our system has notified us, that you currently have a film overdue." & vbNewLine & "Please can you return this film to your nearest Blockbuster store, or a penalty charge will apply after 2 days." & vbNewLine & vbNewLine & "Thank You. " & vbNewLine & "Yours Faithfully," & vbNewLine & vbNewLine & "Blockbuster Team", True
End Sub
it works perfectly on my pc at home, just not on pcs that dont have outlook express. is there a way to detect if it can create the email? as if it cant, the program hangs for about 30 secs, and then displays an error. can u refer me to the 'mailto' thing u was talking about, maybe i could try that.
thanx
dev
> >well it works if u have outlook express installed. i tried it on my m8s pc > >today, and some msn 'passport' screen loads up, and then crashes. (Cos he [quoted text clipped - 18 lines] > Bernard Peek > London, UK. DBA, Manager, Trainer & Author. Bernard Peek - 24 Feb 2006 16:47 GMT >ok, its this; OK. I'll take a look at that code, it looks a lot like mine (but tidier.)
If you take a look in the demon.ip.support.turnpike newsgroup on Google you should be able to find this message ID:
<g8h+ltEeiwAAFAMX@dessergroup.com>
It's part of a thread discussing the problems we had with Turnpike as a mail client with Access.
 Signature Bernard Peek London, UK. DBA, Manager, Trainer & Author.
Bernard Peek - 27 Feb 2006 14:29 GMT >>ok, its this; > [quoted text clipped - 8 lines] >It's part of a thread discussing the problems we had with Turnpike as a >mail client with Access. I've tried this code now. It didn't take long. It works provided the length of the mailto URL is less than 456 characters. That appears to be true whatever mail client you use.
See: http://support.microsoft.com/default.aspx?scid=kb;en-us;182985
I've also discovered that there's no need to use the character replacement function, I can just pass raw text as the subject and body text.
 Signature Bernard Peek London, UK. DBA, Manager, Trainer & Author.
james.igoe@gmail.com - 27 Feb 2006 15:06 GMT Below is a function that is passed recipient string and memo body, but requires Outlook. I work in large corporations, so almost all PC's have standard build that include Outlook:
Function fxSendDBBackupReport(strRecipients As String, strLogInfo) As Boolean
Dim objOutlookApp As New Outlook.Application Dim objOutlookMail As Outlook.MailItem Dim objOutlookAttachments As Outlook.Attachments
Set objOutlookApp = CreateObject("Outlook.Application") Set objOutlookMail = objOutlookApp.CreateItem(olMailItem)
With objOutlookMail .To = strRecipients .Subject = "Report - " & Now .Body = vbCrLf & vbCrLf & strLogInfo & vbCrLf & vbCrLf .Send End With
fxSendDBBackupReport = True
Exit Function
'releases resources from outlook and associated components If Not objOutlookApp Is Nothing Then
objOutlookApp.Quit
If Not objOutlookMail Is Nothing Then Set objOutlookMail = Nothing End If
If Not objOutlookAttachments Is Nothing Then Set objOutlookAttachments = Nothing End If
Set objOutlookApp = Nothing
End If
fxSendDBBackupReport = False
End Function
James Igoe
james.igoe@gmail.com Access/Excel VBA Developer http://code.comparative-advantage.com
Red - 28 Feb 2006 19:22 GMT sorry to chime in so late...
but...
http://www.granite.ab.ca/access/email.htm <--great email info for access... and while alot of it (if not all) was based on A97, it is very usefull in understand the mechanics of emailing in Access.
~Red
|
|
|