View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
keri keri is offline
external usenet poster
 
Posts: 34
Default Looping through code for every record in a table

Hi,

I have a table with 2 fields - flddate and category. There are 999
records in the table. Currently I use the below code to create an
outlook appointment from one of the records in the table. However I
would like to loop through each of the records to create an outlook
appointment for each of the records. I guess I need to create an ID
for each record and loop through the reocrd numbers but I don't know
where to start.

Private Sub Command6_Click()
DoCmd.Save
Dim objFolder As MAPIFolder
Dim spobj As Variant
Set spobj = CreateObject("Outlook.Application")
Dim outobj As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Set outobj = CreateObject("outlook.application")
Set objAppt = outobj.CreateItem(olAppointmentItem)
With objAppt
objAppt.Start = [fldDate]
objAppt.AllDayEvent = True
.Subject = category
.ReminderSet = False
.Save
DoCmd.RunCommand acCmdSaveRecord
End With
End Sub

Thanks,