Hi All,
Pls help me with another issue....
Here's a code that I'm using:
Issue: When this code is executed normally, the messagebox is blank. However, when i put in a breakpoint anywhere to execute the code, the messagebox displays the correct values.. I'm using this messagebox recordset variable to export some data in an Excel file so currently, it displays blank.. The field does get updated as I can see the data in there...
Apparantly, during normal execution, the update is still going on when the next query picks up the values?
Any clues on how to prevent this please?
Pls help me with another issue....
Here's a code that I'm using:
Code:
Set rsMain = New ADODB.Recordset
vSQL = "SELECT * from tmpHCRECON_PROD2"
Set rsMain = conMain.Execute(vSQL)
rsMain.MoveFirst
Do While Not rsMain.EOF
vRemark = ""
If rsMain(16) = "AOD" Then
vRemark = "Employee is on " & rsMain(16) & " since " & rsMain(23)
ElseIf rsMain(16) = "TransferOut" Then
vRemark = "Please remove from PSHR as Employee Transferred Out with TransferOut Date " & rsMain(24)
ElseIf rsMain(16) = "Refer2HR" Then
vRemark = "Please remove from PSHR as Employee is Referred to HR with Ref2HR Date " & rsMain(25)
ElseIf rsMain(16) = "Attrition" Then
vRemark = "Please remove from PSHR as Employee has attrited with LWD " & rsMain(22) & " and DOA " & rsMain(21)
End If
vRemark = vRemark & "."
Set rsFirst = New ADODB.Recordset
vSQL = "select wfm_remarks from tmpHCRECON_PROD2 where emp_id=" & rsMain(0)
rsFirst.Open vSQL, StrCon, adOpenDynamic, adLockBatchOptimistic
rsFirst(0) = vRemark
rsFirst.UpdateBatch
rsMain.MoveNext
Loop
Set rsFirst = Nothing
oWS.Name = SheetName 'renaming the worksheet
Set rsSecond = New ADODB.Recordset
vSQL = "SELECT emp_id,emp_name,wfm_remarks from tmpHCRECON_PROD2 order by emp_id asc"
Set rsSecond = conMain.Execute(vSQL)
MsgBox rsSecond(2)
------
------
Apparantly, during normal execution, the update is still going on when the next query picks up the values?
Any clues on how to prevent this please?
Comment