Access VBA For Email

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

karlhaywood

Thread Starter
Account Closed
Joined
Jan 17, 2010
Messages
680
Hi,

I have created a form and want to be able to email the record that is on screen, can anyone help me with this.

These are the text boxes on the form:

Task Name
Assigned To
Expected completion date
Description of task

These 2 are in no table or query.
Recipient
Subject
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Karl, you should be able to use a modified version of one of the codes on the form in the attached database.
I think you may already have a copy though.
 

Attachments

karlhaywood

Thread Starter
Account Closed
Joined
Jan 17, 2010
Messages
680
I probably do have a copy, but it would be stored on my external hard drive and it packed up lol. I will try this and get back to you.
 

karlhaywood

Thread Starter
Account Closed
Joined
Jan 17, 2010
Messages
680
OBP i have this code below, Could you help me alter this? The reason i would prefer to use this is that the database will be on 4 different machines so when sending an email it will be from the email address being used on that machine.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
You didn't show any code. The code that I used on that form normally uses the mailing program on the users computer.
 

karlhaywood

Thread Starter
Account Closed
Joined
Jan 17, 2010
Messages
680
I know, but you have to enter an email address in the code, the email address will be different on every machine. Here is the code.

Private Sub SendMailBttn_Click()
'Open an instance of microsoft outlook, name it olk.
Dim olk As Outlook.Application
Set olk = CreateObject("Outlook.application")
'Create a new, empty outlook e-mail message
Dim olkMsg As Outlook.Mailitem
Set olkMsg = olk.Createitem(olMailitem)
'Put data from form into the new message
With olkMsg
Dim OlkRecip As Outlook.Recipient
Set OlkRecip = .Recipients.Add(Me![MsgAddress])
OlkRecip.Type = olTo
.subject = Me![MsgSubject]
.Body = Me![MsgBody]
.Send
End With
Set olk = Nothing
Set olkMsg = Nothing
Set OlkRecip = Nothing
End Sub
 

OBP

Joined
Mar 8, 2005
Messages
19,895
You only have to do the same as that code and have a Recipient field on the form.
 

karlhaywood

Thread Starter
Account Closed
Joined
Jan 17, 2010
Messages
680
Not the recipient, the email address of where the email is being sent from!
 

OBP

Joined
Mar 8, 2005
Messages
19,895
You shouldn't need to do that at all, Outlook default should do it.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top