Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending e-mail from Access

Status
Not open for further replies.
Aug 15, 2002
22
GB
Hi all

A colleague of mine is developing an access database that sends an e-mail on the click of a button (the code is below), this works fine on her PC, but when I try and run the same process on my PC then I get the "Activex Component can't create object" error. We have both been looking at this issue for a while now and even after trawling the internet we have not found anything that works.

We have noticed that we are on different versions of outlook 2003, mine is 2003 (11.6568.6568) SP2. Has anybody got any ideas please - I have tried registering a number of DLL's but to no avail.

Any ideas greatly received.

-----------------------------------
Private Sub Command85_Click()
On Error GoTo Err_Command85_Click

Dim strDocName As String
Dim strticket, strBody, strDesc, strSubject, strEmail, strFoundingBody As String

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

strDocName = "Get assigned to"
DoCmd.OpenForm strDocName
DoCmd.Minimize

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

strticket = Forms![Input Ticket]!Text54
strEmail = Forms![Get assigned to]!EMail
strDesc = Forms![Input Ticket]!Text21
strFoundingBody = Forms![Get assigned to]![Founding Body]

strSubject = "Enquiry Reference - " & strticket
strSubject = strSubject & " Founding Body " & strFoundingBody

strBody = "Enquiry Reference " & strticket
strBody = strBody & " has been assigned to you. A description of the enquiry is shown below." & Chr(13) & Chr(13)
strBody = strBody & "Description:" & Chr(13) & Chr(13)
strBody = strBody & strDesc & Chr(13) & Chr(13)
strBody = strBody & "Kind Regards" & Chr(13) & Chr(13)
strBody = strBody & " Enquiry Centre" & Chr(13)
strBody = strBody & "t: 0000 000 000" & Chr(13)
strBody = strBody & "e: james@me.co.uk"


With objEmail
.To = strEmail
.Subject = strSubject
.Body = strBody
.Display
End With

Set objEmail = Nothing

DoCmd.Close acForm, strDocName
DoCmd.Close acForm, "Input Ticket"


Exit_Command85_Click:
Exit Sub

Err_Command85_Click:
MsgBox Err.Description
Resume Exit_Command85_Click

End Sub
----------------------------------

Many thanks

James
 
which line is giving you the error?

i'm on 2k3.sp2 and it's just not giving the error.

ps. the line:

Code:
Dim strticket, strBody, strDesc, strSubject, strEmail, strFoundingBody As String

only makes strFoundingBody a string, unlike c/c++, the rest are variants. so you know.

mr s. <;)

 
Have you checked for missing or broken references in your project library?

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top