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

using recordset

Status
Not open for further replies.

ArchonSoft

Programmer
Jan 20, 2003
35
CA
I used them before but it was a longtime ago..
in my code I import outlook data that i'd like to put in my table "mail" using recordset to navigate from one record to another.
here is the code:
Private Sub btnImportMail_Click()
'variables
Dim strFrom As String
Dim strTo As String
Dim strAttachment As String
Dim bAttachment As Boolean
Dim rsMail As Recordset

Set olapp = CreateObject("Outlook.Application")
Set objNameSpace = olapp.GetNamespace("MAPI")
Set objFolder = objNameSpace.PickFolder
Me.RecordSource = "mail"

For Each mail In objFolder.Items
strFrom = mail.SenderName
strTo = mail.To
strCc = mail.Cc
strSubject = mail.Subject
For Each attachs In mail.Attachments
strAttachment = strAttachment & attachs.DisplayName & vbCrLf
Next attachs
rsMail.Fields("To") = strTo
strAttachment = ""
rsMail.MoveNext
rsMail.AddNew
Next mail
End Sub

I know it's wrong, i'd like someone to help me correct it.
Thanks
 
You have to set RsMail to your recordset using the OPENRECORDSET syntax. Don't knwo where to put it in, but the access help has good examples. Hope this helps.

Jim DeGeorge [wavey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top