小弟遇到下面的奇怪问题!!
每次进入For each循环对集合进行遍历时,总会出现错误
“对象不可用”
为什么呢??
高手们帮帮忙啊!!!!''''''''在模块中定义下面的类型''''''''''
type LineRef
LineCtoNCol as new collection
LineNtoCCol as new collection
end typeglobal LineRef as LineRef
''''''''''''''''''''''''''''''''''''''rs.Open "select distinct linecode,linename from test_linebasicinfo", gafcConnect
If rs.EOF = False Or rs.BOF = False Then
rs.MoveFirst
While rs.EOF = False
LineRef.LineCtoNCol.Add rs!linename, rs!linecode
LineRef.LineNtoCCol.Add rs!linecode, rs!linename
rs.MoveNext
Wend
End If
rs.Close
''''''infocombo为ComboBox
For Each LineInfo In LineRef.LineCtoNCol
InfoCombo.AddItem LineInfo
InfoCombo.ItemData(InfoCombo.NewIndex) = LineRef.LineNtoCCol(LineInfo )
Next
每次进入For each循环对集合进行遍历时,总会出现错误
“对象不可用”
为什么呢??
高手们帮帮忙啊!!!!''''''''在模块中定义下面的类型''''''''''
type LineRef
LineCtoNCol as new collection
LineNtoCCol as new collection
end typeglobal LineRef as LineRef
''''''''''''''''''''''''''''''''''''''rs.Open "select distinct linecode,linename from test_linebasicinfo", gafcConnect
If rs.EOF = False Or rs.BOF = False Then
rs.MoveFirst
While rs.EOF = False
LineRef.LineCtoNCol.Add rs!linename, rs!linecode
LineRef.LineNtoCCol.Add rs!linecode, rs!linename
rs.MoveNext
Wend
End If
rs.Close
''''''infocombo为ComboBox
For Each LineInfo In LineRef.LineCtoNCol
InfoCombo.AddItem LineInfo
InfoCombo.ItemData(InfoCombo.NewIndex) = LineRef.LineNtoCCol(LineInfo )
Next
Lineinfo 是变体型的
我现在发现一个更奇怪的问题
LineRef.LineNtoCCol(1)
都出错了,告诉我"对象不再有效"
这是为什么呢??
global LineRef as LineRef声明的自定义类型的变量
在窗体中无法使用呢???
这一句好象不对吧???
Field 属于 RecordSet,记录关闭后字段被释放,当然不可用了