Input Dates From Access Table to Outlook

R

RON GIBSON

I got the following to work but it only takes the last record. Can someone
look at the code to see what is wrong.

Ron

Sub Date_Import()


dbfullname = "C:\dates1.mdb"

Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
dbfullname & ";"
Set rs = New ADODB.Recordset
rs.Open "select * from date1", cn
Dim myOlApp As Outlook.Application
Dim myApptItem As Outlook.AppointmentItem
Dim myRecurrPatt As Outlook.RecurrencePattern
Dim myNamespace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myItems As Outlook.Items
Dim myDate As Date
Dim myOddApptItem As Outlook.AppointmentItem
Dim saveSubject As String
Dim newDate As Date
Dim myException As Outlook.Exception
Set myOlApp = New Outlook.Application
Set myApptItem = myOlApp.CreateItem(olAppointmentItem)




Do Until rs.EOF

myApptItem.Start = rs("date1")

myApptItem.End = rs("date1")

myApptItem.Subject = rs("des")

myApptItem.Save

rs.MoveNext

Loop


End Sub
 
T

TC

Presumeably you need to create a new olAppointmentItem /inside/ the
loop - not outside it. At present you are just creating one item & then
repeatedly changing that one item's properties.

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top