多谢有点甜老师,问题已解决,代码如下产品表,currentchanged事件:
If Forms("关联产品").Opened() Then
Dim t As Table = Tables("关联产品_Table1")
Dim dr As DataRow
Dim id As Integer
With Tables("产品表")
If Tables("产品表").Current Is Nothing Then
t.Filter = "False"
Else
dr = DataTables("货位表").Find("产品编码 = " & "'" & e.Table.Current("产品编码") & "'")
id = dr("_Identify")
t.Filter = "_Identify >= '" & id-5 & "' And _Identify <= '" & id+5 & "'"
Tables("关联产品_Table1").Position = 5
End If
End With
End If
但是新的问题出现了:
我想在窗口“关联产品”中的table1反定位产品表中的产品时,产品表的postion不断的循环-1,直至卡死,
dr=nothing时没问题,dr不等于nothing时就会出现上述问题。
窗口“关联产品”的“table1”的currentchanged事件,代码如下:
If e.Table.Current Is Nothing Then
Return
End If
Dim wz As Integer
Dim dr As DataRow
dr = DataTables("产品表").Find("[产品编码] =
'" & e.Table.Current("产品编码") &
"'")
If dr IsNot Nothing Then
wz = Tables("产品表").FindRow(dr)
If wz >= 0 Then
Tables("产品表").Position = wz
End If
End If
请问这是为啥