我已经尝试了我能想到的所有方法,但在提取时仍然出现错误
我在每个Select语句的多值字段中循环,并需要将返回值存储在另一个多值字段中。它在第一次循环中有效,但在第二次循环时在Fetch中出错。
If lc_conn.IsConnected Then
For a = 0 To UBound(uniquePlans)
b = 0
SelectStatement2 = "Select Count(CSSN) as counter From cbsdta.covgold where " &_
" CEFFDT<" & todaysDate & " And (CTRMDT=0 Or CTRMDT>=" & todaysDate & ") And " &_
"CDTASRC='GIAS' AND CABSGP='" & groupNo & "' AND CPRODTA='" & uniquePlans(a) & "'"
Count2 = lc_conn.Execute(SelectStatement2, fldLstRecord2 )
if Count2 <> 0 then
While (LC_Conn.Fetch( fldLstRecord2 ) > 0) '<---- Error here on 2nd loop
redim Preserve CoveredLives(b)
Set CoveredLives(b) = fldLstRecord2.Lookup("counter").value
b = b + 1
Wend
End if
Next
doc.CoveredLives = CoveredLives
End If
感谢所有想法或建议
2条答案
按热度按时间mcdcgff01#
原来,我需要在循环中使用'Delete fldListRecord2'命令清除fldListRecord2。添加该命令后,一切都正常了。我还必须在循环中变暗LCFieldList,以便每次都重新初始化它。
谢谢你的建议