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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DougP this one is for you. 1

Status
Not open for further replies.

scowen

MIS
Aug 6, 2001
27
GB
Hi

I am writing a system in Access 2000 that will accept email input. I have managed to link a table to a mailbox on our Exchange server. But I am unable to get at the attachments, which is the important bit. I have looked in the table which shows that the attachment field is set to true, but there does not seem to be a refrence of the location of the attachment.

Any ideas??

I have checked out a few tech refs etc but I am unable to find the answer.

Thanks

Simon
 
Here is a sample subroutine using the Outlook reference objects. I look for unread messages and count the attachments. It was just an initial subroutine to check out the Outlook objects. You would need to tailor it as needed. Notice it doesn't require attachment of the tables.

Steve King

Public Sub CheckForUnread()

Dim olMsg As MailItem
Dim olAttachments As Attachment
Dim intMsgCount As Integer
Dim intMsgTotal As Integer
Dim intAttachments As Integer
On Error Resume Next
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set olFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
intMsgCount = 1
intMsgTotal = olFolder.Items.Count
Debug.Print "Total Msgs = " & intMsgTotal
Do Until intMsgCount = intMsgTotal
Debug.Print "intMsgCount is " & intMsgCount & " and " _
& "intMsgTotal is " & intMsgTotal
Set olMsg = olFolder.Items(intMsgCount)
If Not olMsg.UnRead Then
Debug.Print olMsg.Subject
End If
If olMsg.Attachments.Count > 0 Then
Debug.Print olMsg.Subject & " has " & olMsg.Attachments.Count _
& " attachment(s) for a total size of " _
& olMsg.Size
If InStr(1, olMsg.Subject, "LogGen Cmd") Then
Call SaveAttachment(olMsg)
End If
intAttachments = intAttachments + _
olMsg.Attachments.Count
End If
intMsgCount = intMsgCount + 1
DoEvents
Loop
Debug.Print "Total Attachments " & intAttachments
End Sub
Growth follows a healthy professional curiosity
 
Steve

You are the man. THANKS THANKS THANKS and thanks again.

We have been looking to the answer for this on for weeks.
We have just tried this out and with a little fettling all went well.

We can now get to our attachments.

Thanks

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top