Sameer
Registered User.
- Local time
- Yesterday, 22:31
- Joined
- Nov 5, 2002
- Messages
- 20
I am using following codes to tranfer emails from particular folder to access database:
Dim appAccess
Dim nms
Dim strFolder
Dim fld
Dim strAccessPath
Dim rst
Dim dbe
Dim wks
Dim dbs
Dim itms
Dim itm
Sub CommandButton1_Click()
Set nms = Application.GetNamespace("MAPI")
strFolder = "comtest"
Set fld = nms.Folders("Personal Folders").Folders(strFolder)
'Pick up path to Access database directory from Access SysCmd function
Set appAccess = CreateObject("Access.Application")
strAccessPath = appAccess.SysCmd(9)
'Get DAO version from DBEngine
strDBEngine = appAccess.Application.DBEngine.Version
'MsgBox "DBEngine version: " & strDBEngine
appAccess.Quit
If strDBEngine = "3.51" Then
'Office 97 DAO version
Set dbe = CreateObject("DAO.DBEngine.35")
strDBName = strAccessPath & "fbtestdb.mdb"
ElseIf strDBEngine = "3.6" Then
'Office 2000 DAO version
Set dbe = CreateObject("DAO.DBEngine.36")
strDBName = strAccessPath & "fbtestdb.mdb"
Else
MsgBox "Unknown Office version; canceling"
Exit Sub
End If
'MsgBox "DBName: " & strDBName
Set wks = dbe.Workspaces(0)
Set dbs = wks.OpenDatabase("C:\My Documents\comtest.mdb")
'Open Access table containing contact data
Set rst = dbs.OpenRecordset("Table1")
'Set up reference to Outlook folder of items to export
Set itms = fld.Items
ItemCount = itms.Count
If ItemCount = 0 Then
MsgBox "No communication requests to export"
Exit Sub
Else
MsgBox ItemCount & " Communication requests to export"
End If
'Set up reference to Outlook folder of items to export
Set itms = fld.Items
ItemCount = itms.Count
If ItemCount = 0 Then
MsgBox "No Communication requests to export"
Exit Sub
Else
MsgBox ItemCount & " Communication requests to export"
End If
For Each itm In itms
rst.AddNew
'Custom Outlook properties
rst.Datecircular=itm.Sent
rst.subject =itm.Subject
rst.circular=itm.HTMLBody
rst.Update
Next
rst.Close
MsgBox "All communication requests exported!"
MsgBox "Quit Access"
appAccess.Quit
End Sub
Now, my problem is:
1.The date in access data base comes as 12/29/1899 for all the emails transferred.
2.Our corporate emails carry pictures from clip art and little formatting.When I transfer them to database, I loose all pictures and formatting.The body portion is kept as memo field in access.
Please help.
Thanks
Sameer
Dim appAccess
Dim nms
Dim strFolder
Dim fld
Dim strAccessPath
Dim rst
Dim dbe
Dim wks
Dim dbs
Dim itms
Dim itm
Sub CommandButton1_Click()
Set nms = Application.GetNamespace("MAPI")
strFolder = "comtest"
Set fld = nms.Folders("Personal Folders").Folders(strFolder)
'Pick up path to Access database directory from Access SysCmd function
Set appAccess = CreateObject("Access.Application")
strAccessPath = appAccess.SysCmd(9)
'Get DAO version from DBEngine
strDBEngine = appAccess.Application.DBEngine.Version
'MsgBox "DBEngine version: " & strDBEngine
appAccess.Quit
If strDBEngine = "3.51" Then
'Office 97 DAO version
Set dbe = CreateObject("DAO.DBEngine.35")
strDBName = strAccessPath & "fbtestdb.mdb"
ElseIf strDBEngine = "3.6" Then
'Office 2000 DAO version
Set dbe = CreateObject("DAO.DBEngine.36")
strDBName = strAccessPath & "fbtestdb.mdb"
Else
MsgBox "Unknown Office version; canceling"
Exit Sub
End If
'MsgBox "DBName: " & strDBName
Set wks = dbe.Workspaces(0)
Set dbs = wks.OpenDatabase("C:\My Documents\comtest.mdb")
'Open Access table containing contact data
Set rst = dbs.OpenRecordset("Table1")
'Set up reference to Outlook folder of items to export
Set itms = fld.Items
ItemCount = itms.Count
If ItemCount = 0 Then
MsgBox "No communication requests to export"
Exit Sub
Else
MsgBox ItemCount & " Communication requests to export"
End If
'Set up reference to Outlook folder of items to export
Set itms = fld.Items
ItemCount = itms.Count
If ItemCount = 0 Then
MsgBox "No Communication requests to export"
Exit Sub
Else
MsgBox ItemCount & " Communication requests to export"
End If
For Each itm In itms
rst.AddNew
'Custom Outlook properties
rst.Datecircular=itm.Sent
rst.subject =itm.Subject
rst.circular=itm.HTMLBody
rst.Update
Next
rst.Close
MsgBox "All communication requests exported!"
MsgBox "Quit Access"
appAccess.Quit
End Sub
Now, my problem is:
1.The date in access data base comes as 12/29/1899 for all the emails transferred.
2.Our corporate emails carry pictures from clip art and little formatting.When I transfer them to database, I loose all pictures and formatting.The body portion is kept as memo field in access.
Please help.
Thanks
Sameer