G
Guest
I have two tables on where tickets are entered in to a log and one where we
import processed tickets. I need to compare these tables weekly and if the
ticket numbers match insert the processed date from the imported table into
the log table so i can the run a report on ticket that have not been
processed. The procedure I have runs with no error messages but it does not
update the table.
Public Sub CheckProcessed()
On Error GoTo Check_Err
Dim cnn As ADODB.Connection
Dim rstLog As ADODB.Recordset
Dim rstProc As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rstLog = New ADODB.Recordset
Set rstProc = New ADODB.Recordset
rstLog.Open "tblPaperRefunds", cnn, adOpenDynamic, adLockOptimistic
rstProc.Open "tblPPRREfundsProc", cnn, adOpenDynamic, adLockOptimistic
Do While Not rstLog.EOF
Do While Not rstProc.EOF
If rstLog("TicketNumber") = rstProc("TicketNumber") Then
rstLog("DateProcessed") = rstProc("DateProcessed")
rstLog.Update
End If
rstProc.MoveNext
Loop
rstLog.MoveNext
Loop
Set rstLog = Nothing
Set rstProc = Nothing
Set cnn = Nothing
Check_Exit:
Exit Sub
Check_Err:
MsgBox (Err.Description)
Resume Check_Exit
End Sub
I tried replacing the " rstLog("DateProcessed") = rstProc("DateProcessed")
rstLog.Update" lined with "debug.print rstLog("Ticketnumber")" as a test and
i found that it does not return any matching data.
Any help with this would be greatly appreciated.
import processed tickets. I need to compare these tables weekly and if the
ticket numbers match insert the processed date from the imported table into
the log table so i can the run a report on ticket that have not been
processed. The procedure I have runs with no error messages but it does not
update the table.
Public Sub CheckProcessed()
On Error GoTo Check_Err
Dim cnn As ADODB.Connection
Dim rstLog As ADODB.Recordset
Dim rstProc As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rstLog = New ADODB.Recordset
Set rstProc = New ADODB.Recordset
rstLog.Open "tblPaperRefunds", cnn, adOpenDynamic, adLockOptimistic
rstProc.Open "tblPPRREfundsProc", cnn, adOpenDynamic, adLockOptimistic
Do While Not rstLog.EOF
Do While Not rstProc.EOF
If rstLog("TicketNumber") = rstProc("TicketNumber") Then
rstLog("DateProcessed") = rstProc("DateProcessed")
rstLog.Update
End If
rstProc.MoveNext
Loop
rstLog.MoveNext
Loop
Set rstLog = Nothing
Set rstProc = Nothing
Set cnn = Nothing
Check_Exit:
Exit Sub
Check_Err:
MsgBox (Err.Description)
Resume Check_Exit
End Sub
I tried replacing the " rstLog("DateProcessed") = rstProc("DateProcessed")
rstLog.Update" lined with "debug.print rstLog("Ticketnumber")" as a test and
i found that it does not return any matching data.
Any help with this would be greatly appreciated.