S
shanej2015 at yahoo dot com
Hello,
I've been working on this for a while, and can't get it to work. I am
using Access and Outlook 2003. The following code give me "Error 3276
Invalid database object reference." None of the searches I've done on
this issue help, so any help would be great.
Function AttachContcts()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This code requires that the following object library be
referenced:
' Microsoft DAO 3.6 Object Library.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim db As DAO.Database
Dim td As DAO.TableDef
On Error GoTo Errorhandler
Set db = CurrentDb()
Set td = db.CreateTableDef("newtable")
'Within the following line, replace <mailbox name> with the actual
'Exchange mailbox name created on your computer.
td.Connect = "Exchange 4.0;MAPILEVEL=Personal
Folders|Contacts;PROFILE=Yahoo;TABLETYPE=0;" _
& "DATABASE=" & db.Name
'Substitute the name of the email folder you wish to attach.
'In this example, we will attach the Inbox folder.
td.SourceTableName = "Media"
db.TableDefs.Append td
Application.RefreshDatabaseWindow
MsgBox "Table Appended!"
Exit Function
Errorhandler:
MsgBox "Error " & Err & " " & Error & " " & td.Connect
Exit Function
End Function
I've been working on this for a while, and can't get it to work. I am
using Access and Outlook 2003. The following code give me "Error 3276
Invalid database object reference." None of the searches I've done on
this issue help, so any help would be great.
Function AttachContcts()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This code requires that the following object library be
referenced:
' Microsoft DAO 3.6 Object Library.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim db As DAO.Database
Dim td As DAO.TableDef
On Error GoTo Errorhandler
Set db = CurrentDb()
Set td = db.CreateTableDef("newtable")
'Within the following line, replace <mailbox name> with the actual
'Exchange mailbox name created on your computer.
td.Connect = "Exchange 4.0;MAPILEVEL=Personal
Folders|Contacts;PROFILE=Yahoo;TABLETYPE=0;" _
& "DATABASE=" & db.Name
'Substitute the name of the email folder you wish to attach.
'In this example, we will attach the Inbox folder.
td.SourceTableName = "Media"
db.TableDefs.Append td
Application.RefreshDatabaseWindow
MsgBox "Table Appended!"
Exit Function
Errorhandler:
MsgBox "Error " & Err & " " & Error & " " & td.Connect
Exit Function
End Function