Creating email via Access Form

  • Thread starter Thread starter alathwell
  • Start date Start date
A

alathwell

I am using the following code to generate an email. In the fronte end copy I
have on my machine the code works perfectly.

Set Olk = CreateObject("Outlook.Application")

Dim OlkMsg As Outlook.MailItem
Set OlkMsg = Olk.CreateItem(olMailItem)

With OlkMsg

Dim OlkRecip As Outlook.Recipient

Set OlkRecip = .Recipients.Add(Me!)
OlkRecip.Type = olTo

I have installed a copy of the same front end on two other machines and I
get the following VB error when running this code.

-------------------------------
Run-Time Error '287'

Application-defined or object-defined error

-------------------------------------

If I step through the code it is only the line below that errors

Set OlkRecip = .Recipients.Add(Me![email]) <<<<<<<<<Error Here

I cannot find what the difference it between the Access versions expect the
version of VB used on working machine is version 1024 whereas the not working
machine is version 1020.

Any help would be most appreciated.

Regards

alathwell
 
I am using the following code to generate an email. In the fronte end copy I
have on my machine the code works perfectly.

Set Olk = CreateObject("Outlook.Application")

Dim OlkMsg As Outlook.MailItem
Set OlkMsg = Olk.CreateItem(olMailItem)

With OlkMsg

Dim OlkRecip As Outlook.Recipient

Set OlkRecip = .Recipients.Add(Me!)
OlkRecip.Type = olTo

I have installed a copy of the same front end on two other machines and I
get the following VB error when running this code.

-------------------------------
Run-Time Error '287'

Application-defined or object-defined error

-------------------------------------

If I step through the code it is only the line below that errors

Set OlkRecip = .Recipients.Add(Me![email]) <<<<<<<<<Error Here

I cannot find what the difference it between the Access versions expect the
version of VB used on working machine is version 1024 whereas the not working
machine is version 1020.

Any help would be most appreciated.

Regards

alathwell[/QUOTE]

FWIW, here's an example that works... tweak it to suit your needs:
http://www.amazecreations.com/datafast/CodePages/CodeOutlookMail.asp
 
Back
Top