Creating email via Access Form

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
 
P

Piet Linden

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top