V
Vaughan
I really hope someone can help. Many many thanks to anyone who can.
I have some code that copies certain details of items in a public folder
into a table in Access for reporting. I have no training or expertise, and I
created this code largely in the dark after a lot of research (much credit to
Sue's book) and trial and error. But it works (at least until today).
Today, though, it doesn't work. The details for the first 233 items are
copied into the table as expected, but after that the remaining 500 or so
items all show the same details as the 234th (with the exception of the
item's message class, which seems to be correct).
Here is my code if it helps:
Sub TransferMinutesToAccess()
On Error Resume Next
Dim objADOConn As Object
Dim objADORS As Object
Dim objMinItem As Object
Dim objMinItems As Outlook.Items
Dim objFolder As Object
Dim arrMinItem(12) As Variant
Dim dtmMinItem As Date
Dim intUniqueNo As Integer
strMinFolderPath = "Public Folders\All Public Folders\Projects\Project
Details\Minutes"
Set objADOConn = New ADODB.Connection
Set objADORS = New ADODB.RecordSet
objADOConn.Open "DSN=ProjectPacks"
With objADORS
.Open "Select * From tbl_ExchangeMinutes", objADOConn, adOpenStatic,
adLockOptimistic
If Not .BOF Then
.MoveFirst
While Not .EOF
.Delete
.MoveNext
Wend
End If
End With
DoCDOLogon
Set objFolder = GetFolder(strMinFolderPath)
Set objMinItems = objFolder.Items.Restrict("[Message
Class]<>""IPM.Post.Meeting_Header""")
For Each objMinItem In objMinItems
Set objCDOItem = GetCDOItemFromOL(objMinItem)
Set objFields = objCDOItem.Fields
Set objFlag = objFields.Item(&H10900003)
Set objFlagText = objFields.Item("0x8530",
"0820060000000000C000000000000046")
arrMinItem(1) = objMinItem.UserProperties("Meeting Description")
arrMinItem(2) = objMinItem.UserProperties("Job")
arrMinItem(3) = objMinItem.UserProperties("MeetingDate")
arrMinItem(4) = objMinItem.Body
arrMinItem(5) = objMinItem.ConversationIndex
arrMinItem(6) = objMinItem.UserProperties("AssignedTo")
arrMinItem(7) = objMinItem.UserProperties("DueDate")
arrMinItem(8) = objFlag.Value
arrMinItem(9) = objFlagText.Value
arrMinItem(10) = objMinItem.UserProperties("MeetingThread")
arrMinItem(11) = objMinItem.ConversationTopic
arrMinItem(12) = objMinItem.MessageClass
objADORS.AddNew
For n = 0 To 12
objADORS(n) = arrMinItem(n)
Next n
Next
objADORS.Close
Set objADORS = Nothing
objADOConn.Close
Set objADOConn = Nothing
Set objCDOItem = Nothing
Set objFields = Nothing
Set objFlag = Nothing
Set objFlagText = Nothing
DoCDOLogoff
End Sub
I have some code that copies certain details of items in a public folder
into a table in Access for reporting. I have no training or expertise, and I
created this code largely in the dark after a lot of research (much credit to
Sue's book) and trial and error. But it works (at least until today).
Today, though, it doesn't work. The details for the first 233 items are
copied into the table as expected, but after that the remaining 500 or so
items all show the same details as the 234th (with the exception of the
item's message class, which seems to be correct).
Here is my code if it helps:
Sub TransferMinutesToAccess()
On Error Resume Next
Dim objADOConn As Object
Dim objADORS As Object
Dim objMinItem As Object
Dim objMinItems As Outlook.Items
Dim objFolder As Object
Dim arrMinItem(12) As Variant
Dim dtmMinItem As Date
Dim intUniqueNo As Integer
strMinFolderPath = "Public Folders\All Public Folders\Projects\Project
Details\Minutes"
Set objADOConn = New ADODB.Connection
Set objADORS = New ADODB.RecordSet
objADOConn.Open "DSN=ProjectPacks"
With objADORS
.Open "Select * From tbl_ExchangeMinutes", objADOConn, adOpenStatic,
adLockOptimistic
If Not .BOF Then
.MoveFirst
While Not .EOF
.Delete
.MoveNext
Wend
End If
End With
DoCDOLogon
Set objFolder = GetFolder(strMinFolderPath)
Set objMinItems = objFolder.Items.Restrict("[Message
Class]<>""IPM.Post.Meeting_Header""")
For Each objMinItem In objMinItems
Set objCDOItem = GetCDOItemFromOL(objMinItem)
Set objFields = objCDOItem.Fields
Set objFlag = objFields.Item(&H10900003)
Set objFlagText = objFields.Item("0x8530",
"0820060000000000C000000000000046")
arrMinItem(1) = objMinItem.UserProperties("Meeting Description")
arrMinItem(2) = objMinItem.UserProperties("Job")
arrMinItem(3) = objMinItem.UserProperties("MeetingDate")
arrMinItem(4) = objMinItem.Body
arrMinItem(5) = objMinItem.ConversationIndex
arrMinItem(6) = objMinItem.UserProperties("AssignedTo")
arrMinItem(7) = objMinItem.UserProperties("DueDate")
arrMinItem(8) = objFlag.Value
arrMinItem(9) = objFlagText.Value
arrMinItem(10) = objMinItem.UserProperties("MeetingThread")
arrMinItem(11) = objMinItem.ConversationTopic
arrMinItem(12) = objMinItem.MessageClass
objADORS.AddNew
For n = 0 To 12
objADORS(n) = arrMinItem(n)
Next n
Next
objADORS.Close
Set objADORS = Nothing
objADOConn.Close
Set objADOConn = Nothing
Set objCDOItem = Nothing
Set objFields = Nothing
Set objFlag = Nothing
Set objFlagText = Nothing
DoCDOLogoff
End Sub