I am very much a novice at this, and I'm not finished yet, but this is what I
have so far. I hope it helps:
Sub AccessSelData()
On Error Resume Next
Dim myOlSel As Outlook.Selection
Dim msgbody As String
Dim msg As Object
Dim course As String
Dim msgname As String
Dim msgdate As Date
Dim msgemail As String
Set myOlSel = Outlook.ActiveExplorer.Selection
' I want to be able to export more than one message body at a time, but
haven't gotten it to work yet
'For x = 1 To myOlSel.Count
' Seltxt = myOlSel.Item(x).Body
'Next x
x = myOlSel.Count
Set msg = myOlSel
msgbody = msg.Item(x).Body
msgname = msg.Item(x).SenderName
msgdate = msg.Item(x).SentOn
msgemail = msg.Item(x).SenderEmailAddress
'the DAO reference is from a code example on
www.outlookcode.com
Set appAccess = CreateObject("Access.Application")
strAccessPath = appAccess.SysCmd(9)
strDBName = "d:\Documents and Settings\swh24\My Documents\Course
Analysis Database files\" & "Course Analysis.mdb"
Set dbe = CreateObject("DAO.DBEngine.36")
Set wks = dbe.Workspaces(0)
Set dbs = wks.OpenDatabase(strDBName)
'These are the names of the table data in Access
Set rst = dbs.OpenRecordset("Course Comments")
Set rst1 = dbs.OpenRecordset("Course Analysis-Complete")
Load frmDatabaseAdd 'this is a userform that I created to check the
data
rst1.MoveFirst
Do
frmDatabaseAdd.cboCourse.AddItem (rst1.course.Value)
rst1.MoveNext
If rst1.course.Value = "" Then Exit Do
Loop
frmDatabaseAdd.Show
rst.AddNew
rst.course = course
rst.SendName = msgname
rst.SendDate = msgdate
rst.Comment = msgbody
rst.Update
rst.Close
dbs.Close
MsgBox "Information sent to Course Analysis Database"
End Sub