MarcelBeals
Programmer
I am having such a problem with ADO that I need some help.
I must be looking at this problem to close and can not see the obvious. Here is the code:
Private Sub cmdUpdateEI_Click()
Dim rs_CHH As Recordset
Dim rs_ROE As Recordset
Dim strSQL_CHH As String
Dim strSQL_ROE As String
Dim strDate As String
Set rs_CHH = New ADODB.Recordset
Set rs_ROE = New ADODB.Recordset
strDate = "20000801"
strEmployee = "01000"
Screen.MousePointer = ccHourglass
strSQL_CHH = "select CHH.EM_EMPLOYEE_ID, " & _
"CHH.CHH_PAY_PERIOD_END_DATE, " & _
"CHH.CHH_WEEKS_HRS_WORKED " & _
"From CHH " & _
"where CHH.CHH_PAY_PERIOD_END_DATE > " & strDate & " and " & _
"CHH.EM_EMPLOYEE_ID < " & strEmployee & _
"ORDER BY CHH.EM_EMPLOYEE_ID, CHH.CHH_PAY_PERIOD_END_DATE"
rs_CHH.Open strSQL_CHH, curConnection, adOpenForwardOnly
rs_CHH.MoveFirst
strSQL_ROE = "select ROE.EM_EMPLOYEE_ID, " & _
"ROE.ROE_PAY_PERIOD_END_DATE, " & _
"ROE.ROE_NUMBER_OF_WEEKS_IN_52WKS " & _
"From ROE " & _
"ORDER BY ROE.EM_EMPLOYEE_ID, ROE.ROE_PAY_PERIOD_END_DATE"
rs_ROE.Open strSQL_ROE, curConnection, adOpenDynamic, adLockPessimistic
rs_ROE.MoveFirst
While rs_CHH.EOF = False And rs_ROE.EOF = False
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE = rs_CHH!CHH_PAY_PERIOD_END_DATE And _
rs_ROE!ROE_NUMBER_OF_WEEKS_IN_52WKS <> rs_CHH!CHH_WEEKS_HRS_WORKED Then
rs_ROE!ROE_NUMBER_OF_WEEKS_IN_52WKS = rs_CHH!CHH_WEEKS_HRS_WORKED
rs_ROE.Update
rs_CHH.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID > rs_CHH!EM_EMPLOYEE_ID Then
rs_CHH.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID < rs_CHH!EM_EMPLOYEE_ID Then
rs_ROE.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE > rs_CHH!CHH_PAY_PERIOD_END_DATE Then
rs_CHH.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE < rs_CHH!CHH_PAY_PERIOD_END_DATE Then
rs_ROE.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE = rs_CHH!CHH_PAY_PERIOD_END_DATE And _
rs_ROE!ROE_NUMBER_OF_WEEKS_IN_52WKS = rs_CHH!CHH_WEEKS_HRS_WORKED Then
rs_CHH.MoveNext
End If
End If
End If
End If
End If
End If
Wend
rs_CHH.Close
rs_ROE.Close
dbg_ROE_After.Refresh
Screen.MousePointer = ccArrow
End Sub
Can someone please help.
Marcel.
I must be looking at this problem to close and can not see the obvious. Here is the code:
Private Sub cmdUpdateEI_Click()
Dim rs_CHH As Recordset
Dim rs_ROE As Recordset
Dim strSQL_CHH As String
Dim strSQL_ROE As String
Dim strDate As String
Set rs_CHH = New ADODB.Recordset
Set rs_ROE = New ADODB.Recordset
strDate = "20000801"
strEmployee = "01000"
Screen.MousePointer = ccHourglass
strSQL_CHH = "select CHH.EM_EMPLOYEE_ID, " & _
"CHH.CHH_PAY_PERIOD_END_DATE, " & _
"CHH.CHH_WEEKS_HRS_WORKED " & _
"From CHH " & _
"where CHH.CHH_PAY_PERIOD_END_DATE > " & strDate & " and " & _
"CHH.EM_EMPLOYEE_ID < " & strEmployee & _
"ORDER BY CHH.EM_EMPLOYEE_ID, CHH.CHH_PAY_PERIOD_END_DATE"
rs_CHH.Open strSQL_CHH, curConnection, adOpenForwardOnly
rs_CHH.MoveFirst
strSQL_ROE = "select ROE.EM_EMPLOYEE_ID, " & _
"ROE.ROE_PAY_PERIOD_END_DATE, " & _
"ROE.ROE_NUMBER_OF_WEEKS_IN_52WKS " & _
"From ROE " & _
"ORDER BY ROE.EM_EMPLOYEE_ID, ROE.ROE_PAY_PERIOD_END_DATE"
rs_ROE.Open strSQL_ROE, curConnection, adOpenDynamic, adLockPessimistic
rs_ROE.MoveFirst
While rs_CHH.EOF = False And rs_ROE.EOF = False
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE = rs_CHH!CHH_PAY_PERIOD_END_DATE And _
rs_ROE!ROE_NUMBER_OF_WEEKS_IN_52WKS <> rs_CHH!CHH_WEEKS_HRS_WORKED Then
rs_ROE!ROE_NUMBER_OF_WEEKS_IN_52WKS = rs_CHH!CHH_WEEKS_HRS_WORKED
rs_ROE.Update
rs_CHH.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID > rs_CHH!EM_EMPLOYEE_ID Then
rs_CHH.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID < rs_CHH!EM_EMPLOYEE_ID Then
rs_ROE.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE > rs_CHH!CHH_PAY_PERIOD_END_DATE Then
rs_CHH.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE < rs_CHH!CHH_PAY_PERIOD_END_DATE Then
rs_ROE.MoveNext
Else
If rs_ROE!EM_EMPLOYEE_ID = rs_CHH!EM_EMPLOYEE_ID And _
rs_ROE!ROE_PAY_PERIOD_END_DATE = rs_CHH!CHH_PAY_PERIOD_END_DATE And _
rs_ROE!ROE_NUMBER_OF_WEEKS_IN_52WKS = rs_CHH!CHH_WEEKS_HRS_WORKED Then
rs_CHH.MoveNext
End If
End If
End If
End If
End If
End If
Wend
rs_CHH.Close
rs_ROE.Close
dbg_ROE_After.Refresh
Screen.MousePointer = ccArrow
End Sub
Can someone please help.
Marcel.