这样可以避免错误:
'''
Forms("窗口1").Controls("TextBox2").Value = "报错的原因是:_sysSaveProcGroup表中的【1】在_sysSaveProcGroupV2g表中没有对应的记录!请问怎以才可以先判断Current有没有记录?"
Dim TBString As String = e.Form.Controls("TextBox1").Text
With DataTables("_sysSaveProcGroup")
If TBString IsNot Nothing Then
.LoadFilter = "[第一列]= '" & TBString & "'"
.Load
Else
.LoadTop = ""
.LoadOrder = "[第一列] asc"
.Load
End If
End With
If Tables("窗口1__sysSaveProcGroup").Current IsNot Nothing Then
Dim pGp As String = Tables("窗口1__sysSaveProcGroup").Current("第一列")
With DataTables("_sysSaveProcGroupV2")
.LoadFilter = "[第一列]= '" & pGp & "'"
.Load
End With
End If
If Tables("窗口1__sysSaveProcGroupV2").Current IsNot Nothing Then
Dim CPrN As String = Tables("窗口1__sysSaveProcGroupV2").Current("第二列")
With DataTables("_sysSaveProcGroupV3")
.LoadFilter = "[第一列]= '" & CPrN & "'"
.Load
End With
End If
出错的原因是有的表一开始没有数据,Current为Nothing.
建议看看:
http://www.foxtable.com/help/topics/1485.htm
这样遇到问题可以自己调试分析。
[此贴子已经被作者于2013-5-29 18:04:54编辑过]