T
Teresa via AccessMonster.com
I have a table linked to an exchange folder containing emails
(tblCallsToBeLogged).
I am importing some fields into another table (tblLoggedCalls) and then
deleting the corresponding record in tblCallsToBeLogged.
Here's the problem: it imports all but one record.
Where am I going wrong?
Thanks!
------------------------------------------------------------------------------
--------------------------------
Public Sub Import()
Dim dbs As Database
Dim rstExchange As Recordset, rstUsers As Recordset
Dim Receiver As Variant, postIt As Integer
Dim Requester As Variant, Received As Variant
Dim Recorded As Variant, Subject As Variant
Dim Details As Variant, Attachments As Variant
Set dbs = CurrentDb
Set rstExchange = dbs.OpenRecordset("tblCallsToBeLogged")
Set rstUsers = dbs.OpenRecordset("tblLoggedCalls", DB_OPEN_TABLE)
rstExchange.MoveFirst
Do Until rstExchange.EOF ' Begin loop.
On Error Resume Next
rstUsers.AddNew ' Create new record.
rstUsers("Requester") = rstExchange!From
rstUsers("Receiver") = rstExchange!To
rstUsers("Received") = rstExchange!Received
rstUsers("Recorded") = rstExchange![Creation Time]
rstUsers("Subject") = rstExchange![Normalized Subject]
rstUsers("Details") = rstExchange!Body
rstUsers("Attachments") = rstExchange![Has attachments]
rstExchange.Delete
rstUsers.Update ' Save changes.
On Error GoTo errCmdUserDetails
rstExchange.MoveNext ' Locate next record.
Loop ' End of loop.
exitCmdUserDetails:
rstExchange.Close ' Close table.
rstUsers.Close
Set dbs = Nothing
Exit Sub
errCmdUserDetails:
GoTo exitCmdUserDetails
End Sub
(tblCallsToBeLogged).
I am importing some fields into another table (tblLoggedCalls) and then
deleting the corresponding record in tblCallsToBeLogged.
Here's the problem: it imports all but one record.
Where am I going wrong?
Thanks!
------------------------------------------------------------------------------
--------------------------------
Public Sub Import()
Dim dbs As Database
Dim rstExchange As Recordset, rstUsers As Recordset
Dim Receiver As Variant, postIt As Integer
Dim Requester As Variant, Received As Variant
Dim Recorded As Variant, Subject As Variant
Dim Details As Variant, Attachments As Variant
Set dbs = CurrentDb
Set rstExchange = dbs.OpenRecordset("tblCallsToBeLogged")
Set rstUsers = dbs.OpenRecordset("tblLoggedCalls", DB_OPEN_TABLE)
rstExchange.MoveFirst
Do Until rstExchange.EOF ' Begin loop.
On Error Resume Next
rstUsers.AddNew ' Create new record.
rstUsers("Requester") = rstExchange!From
rstUsers("Receiver") = rstExchange!To
rstUsers("Received") = rstExchange!Received
rstUsers("Recorded") = rstExchange![Creation Time]
rstUsers("Subject") = rstExchange![Normalized Subject]
rstUsers("Details") = rstExchange!Body
rstUsers("Attachments") = rstExchange![Has attachments]
rstExchange.Delete
rstUsers.Update ' Save changes.
On Error GoTo errCmdUserDetails
rstExchange.MoveNext ' Locate next record.
Loop ' End of loop.
exitCmdUserDetails:
rstExchange.Close ' Close table.
rstUsers.Close
Set dbs = Nothing
Exit Sub
errCmdUserDetails:
GoTo exitCmdUserDetails
End Sub