Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put contacts from Access into specific mailboxes

Status
Not open for further replies.

chrisgreen

Programmer
Jun 28, 2000
61
GB
How can i put contacts from Access into specific mail boxes in Microsoft exchange server?
 
do you want to use an access table to supply data for Contact info in outlook or simply email it to a mailbox<br>
 
I can put data from an Access database into the contacts folder of the default mailbox.&nbsp;&nbsp;What I want to do is update people contacts in their mailboxes from data in the Access database.&nbsp;&nbsp;There is a field in the table that identies who the contact belongs to, when a change is made to the data the contact is updated.<br><br>Can you help?
 
You can apply this to the particulars of your case this is using outlook 2000 and access 2000 with references to dao<br>You do need an exchange profile for the user on the machine<br>I've been trying to figure a way without it&nbsp;&nbsp;you need to set a reference to the Outlook 9.0 in tools and you can add to what aspect of the contact you want to update<br><br>Public Function EditContacts(strProfile, strPWord As String) As Boolean<br>Dim objOutlook As Outlook.Application<br>Dim objContact As ContactItem<br>Dim nsName As Outlook.NameSpace<br>Dim recA As DAO.Recordset<br>Dim strSql As String<br>&nbsp;<br>&nbsp;strSql = &quot;Select * FROM [YOURTABLE] Where PROFILENAME =&quot; & Chr$(34) & strProfile & Chr$(34)<br>&nbsp;<br>&nbsp;Set recA = CurrentDb().OpenRecordset(strSql, dbOpenDynaset)<br>&nbsp;<br>&nbsp;If IsAppThere(&quot;Outlook.application&quot;) = False Then<br>&nbsp;&nbsp;&nbsp;&nbsp;Set objOutlook = CreateObject(&quot;outlook.application&quot;) 'create new instance<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;Set objOutlook = GetObject<br>, &quot;outlook.application&quot;) 'reference existing instance<br>&nbsp;&nbsp;End If<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;Set nsName = objOutlook.GetNamespace(&quot;MAPI&quot;)<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;nsName.Logon strProfile, strPWord, True, True<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;<br>&nbsp;Set objContact = objOutlook.CreateItem(olContactItem)<br><br>&nbsp;<br>&nbsp;&nbsp;&nbsp;With objContact<br>&nbsp;&nbsp;&nbsp;&nbsp;.FirstName = IIf(IsNull(recA.Fields(0)), &quot;&quot;, recA.Fields(0))<br>&nbsp;&nbsp;&nbsp;&nbsp;.LastName = recA.Fields(1)<br>&nbsp;&nbsp;&nbsp;&nbsp;.Email1Address = recA.Fields(2)<br>&nbsp;&nbsp;&nbsp;&nbsp;.Save<br>&nbsp;&nbsp;&nbsp;&nbsp;End With<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;Set objOutlook = Nothing<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set objContact = Nothing<br>&nbsp;Set nsName = Nothing<br>&nbsp;<br>End Function<br><br><br><br>This checks is Outlook is running or not<br><br>Public Function IsAppThere(appName) As Boolean<br>&nbsp;On Error Resume Next<br>&nbsp;&nbsp;Dim objApp As Object<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;IsAppThere = True<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;Set objApp = GetObject(, appName)<br>&nbsp;&nbsp;&nbsp;If Err.Number &lt;&gt; 0 Then IsAppThere = False<br>&nbsp;&nbsp;&nbsp;<br><br>End Function<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top