Private Sub Form_Load()
Dim iOutlook As Outlook.Application
Dim myitem As Outlook.MailItem
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myAttach As Outlook.Attachment
Dim DB As DAO.Database
Set DB = CurrentDb
Set iOutlook = New Outlook.Application
Set myNameSpace = iOutlook.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set mynewfolder = myFolder.Folders("Inbox")
DB.Execute "delete * from tblTempFaxList"
For I = 1 To mynewfolder.Items.Count
Set myitem = mynewfolder.Items(I)
DB.Execute "INSERT INTO tblTempFaxList ( [#], [Sender], [Date], [Size], [Attachment] ) Values ( '" & I & "', '" & right(myitem.Subject, Len(myitem.Subject) - 31) & "', '" & myitem.CreationTime & "', '" & myitem.Size & "', 'xxx');"
Next I
Set myitem = Nothing
Set myFolder = Nothing
Set mynewfolder = Nothing
Set iOutlook = Nothing
Me.lstIncomingFaxes.Requery
End Sub
|