Christopher Hawkins
clh at christopherhawkins.com
Thu May 27 15:58:38 CDT 2004
Andy,
This looks good for creating the contact. Do you also have sample
code to add a contact to a distribution list?
-Christopher-
---- Original Message ----
From: andy at minstersystems.co.uk
To: accessd at databaseadvisors.com,
Subject: RE: [AccessD] A2K3: Add eMail Addy to Outlook Distibution
List?
Date: Thu, 27 May 2004 21:39:29 +0100
>Christopher
>
>Try something like this. You must set a Reference to the Outlook
>Library.
>
>
>Function CreateContact(frm As Form)
>Dim objOutlook As Outlook.Application
>Dim objOutlookNameSpace As Outlook.NameSpace
>Dim objOutlookItem As Outlook.ContactItem
>Dim objOutlookFolder As Outlook.MAPIFolder
>
>'Create the Outlook session
>Set objOutlook = CreateObject("Outlook.Application")
>Set objOutlookNameSpace = objOutlook.GetNamespace("MAPI")
>'Amend this line to get your contacts folder.
>Set objOutlookFolder = objOutlookNameSpace.Folders("Public Folders
>Or Your
>Top Level").Folders("Next Level").Folders("And So On To Your Folder")
>
>Set objOutlookItem = objOutlookFolder.Items.Add(olContactItem)
>With objOutlookItem
> .BusinessFaxNumber = Nz(frm!txtFax, "")
> .BusinessTelephoneNumber = Nz(frm!txtPhone, "")
> .CompanyName = Nz(frm!txtCompanyName, "")
> .Department = Nz(frm!txtDept, "")
> .Email1AddressType = "SMTP"
> .Email1Address = Nz(frm!txtEmail, "")
> .FileAs = Nz(frm!txtContactName, "")
> .Fullname = Nz(frm!txtContactName, "")
> .JobTitle = Nz(frm!txtJobTitle, "")
> .MobileTelephoneNumber = Nz(frm!txtMobile, "")
> .Subject = Nz(frm!txtCompanyName & " (" & frm!txtContactName &
>")", "")
> .Save
>End With
>
>Exit_CreateContact:
>Call SysCmd(acSysCmdClearStatus)
>Set objOutlookItem = Nothing
>Set objOutlookFolder = Nothing
>Set objOutlookNameSpace = Nothing
>Set objOutlook = Nothing
>End Function
>
>
>-- Andy Lacey
>http://www.minstersystems.co.uk
>
>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
>> Christopher Hawkins
>> Sent: 27 May 2004 21:03
>> To: accessd at databaseadvisors.com
>> Subject: [AccessD] A2K3: Add eMail Addy to Outlook Distibution
>List?
>>
>>
>> Hello all!
>>
>> So, I have finally been called upon to do some interaction
>> with Outlook via Access...and I don't have the foggiest idea
>> how to do it! I already took to Google, but got nothing usable.
>>
>> THE CHALLENGE:
>>
>> Given an Access database with customer records in it, I must
>> add selected customer records to a Newsletter distribution
>> list in Outlook via a button click from the Customer screen.
>>
>> The Newsletter distribution list resides within UserA's
>> Contacts folder, but everyone in the office has permissions
>> to view and update it.
>>
>> Hopefully somebody can point me to a good resource for
>> Access-Outlook interaction, or has done this before and can
>> provide sample code.
>>
>> In the meantime, I'll head back to Google and see what I can
>find...
>>
>> Suggestions?
>>
>> -Christopher Hawkins-
>>
>>
>> --
>> _______________________________________________
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/a> ccessd
>> Website:
>> http://www.databaseadvisors.com
>>
>>
>
>--
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>