测试了一下,是按下回车键选择的时候才出错的吧?
用下面的代码就行了。原因是:执行e.Text = t.Current("收款人")时,触发了changeedit事件,重新筛选,导致current改变。
If e.Col.Name = "收款人" Then
Forms("窗口2").Open()
Dim t As Table = Tables("窗口2_Table1")
If e.keycode = keys.Down
t.position = t.Position +1
e.Cancel = True
ElseIf e.keycode = keys.up
t.position = t.Position -1
e.Cancel = True
ElseIf e.Keycode = keys.Enter And t.Current IsNot Nothing
e.Row("收款人账号") = t.Current("收款人账号")
e.Row("收款人开户银行") = t.Current("收款人开户银行")
e.Row("省") = t.Current("省")
e.Row("ID") = t.Current("ID")
e.Text = t.Current("收款人")
Forms("窗口2").close()
End If
End If