T
TanyaM
In my customer database, in the contact form I have a send contact e-mail
button. when clicked I want to launch an outlook e-mail with the current
record's e-mail populatedin the to field. I can't seem to get it to look at
the current record in the form (it seems to populate from all over the place,
but never the right one). Here's what I have so far:
Private Sub SendEmail_Click()
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem
Dim strLtrContent As String
Dim rsContacts As New ADODB.Recordset
rsContacts.ActiveConnection = CurrentProject.Connection
'Contacts = contact's Table - is there a way to get it to look at the
contact's form?
rsContacts.Open "Contacts"
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Recipients.Add rsContacts("EmailName")
myItem.Display
End Sub
Any help is so appreciated as I'm new at programming in Access.
Thanks,
Tanya
button. when clicked I want to launch an outlook e-mail with the current
record's e-mail populatedin the to field. I can't seem to get it to look at
the current record in the form (it seems to populate from all over the place,
but never the right one). Here's what I have so far:
Private Sub SendEmail_Click()
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem
Dim strLtrContent As String
Dim rsContacts As New ADODB.Recordset
rsContacts.ActiveConnection = CurrentProject.Connection
'Contacts = contact's Table - is there a way to get it to look at the
contact's form?
rsContacts.Open "Contacts"
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Recipients.Add rsContacts("EmailName")
myItem.Display
End Sub
Any help is so appreciated as I'm new at programming in Access.
Thanks,
Tanya