[AccessD] Access Data into Outlook

Andy Lacey andy at minstersystems.co.uk
Thu May 12 17:15:59 CDT 2005


Actually I'll send some code anyway cos I'm off to bed. This function
creates a contact record. Amend the lines to get your folder. The data here
is coming from a Form but you can easily modify that to take the data from a
record, and loop adding for each record. You'll need to set a Reference to
the Outlook library. Oh and add yr own error handling of course.

HTH, g'night.

-- Andy Lacey
http://www.minstersystems.co.uk 


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 next 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

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?
> 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Lonnie Johnson
> Sent: 12 May 2005 21:58
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] Access Data into Outlook
> 
> 
> Sure thing. I actually have a table with employee information 
> but it is in SQL Server. I didn't see anything in Outlook 
> help that said anything about SQL Server. So I thought I 
> would have an Access database with a link to the table and go 
> from there. I want to create a contact list in a public 
> folder in Outlook. It will be like a Company Directory.
>  
> I knew it could be done. Thanks Andy, I'll be looking for your reply.
> 
> Andy Lacey <andy at minstersystems.co.uk> wrote:
> Hi Lonnie
> Yes it is but what are you trying to do? You can use the 
> Outlook object model to link programmatically. Describe what 
> you're after doing and we may be able to make suggestions.
> 
> -- Andy Lacey
> http://www.minstersystems.co.uk 
> 
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> > Lonnie Johnson
> > Sent: 12 May 2005 14:07
> > To: Access Developers discussion and problem solving
> > Subject: Re: [AccessD] Access Data into Outlook
> > 
> > 
> > My subject line was wrong it said Access Data into SQL Server
> > instead of Outlook.
> > 
> > Lonnie Johnson
> wrote:Is it possible to 
> > programatically link, transfer or copy information from an
> > access table (employee information) into a global or public 
> > folder in Outlook?
> > 
> > It's gotta be possible!!!
> > 
> > 
> > 
> > May God bless you beyond your imagination!
> > Lonnie Johnson
> > ProDev, Professional Development of MS Access Databases
> > Visit me at ==> http://www.prodev.us
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------
> > Yahoo! Mail
> > Stay connected, organized, and protected. Take the tour
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com 
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> > 
> > 
> > 
> > May God bless you beyond your imagination!
> > Lonnie Johnson
> > ProDev, Professional Development of MS Access Databases
> > Visit me at ==> http://www.prodev.us
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------
> > Discover Yahoo!
> > Get on-the-go sports scores, stock quotes, news & more. 
> Check it out!
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com 
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> > 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 
> 
> May God bless you beyond your imagination!
> Lonnie Johnson
> ProDev, Professional Development of MS Access Databases
> Visit me at ==> http://www.prodev.us
> 
> 
> 
> 
> 
>  
> 
> 
> 
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
>  Yahoo! Mail - Helps protect you from nasty viruses.
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 




More information about the AccessD mailing list