1、打开命令窗口,然后测试,看命令窗口输出什么内容?
If Forms("库存管理").Opened Then '如果窗口已经打开
If e.Table.Rows.count > 0 Then ‘(数据为空时下面代码应该不会执行才对,为什么还错?)
Output.Show(e.Table.Current is nothing)
Dim dr As DataRow = e.Table.Current.DataRow
Dim wz As Integer = Tables("库存管理_Table1").FindRow(dr)
If wz >=0 Then
Tables("库存管理_Table1").Position = wz
End If
End If
End If
2、测试这个代码
If Forms("库存管理").Opened Then '如果窗口已经打开
If e.Table.Rows.count > 0 Then '(数据为空时下面代码应该不会执行才对,为什么还错?)
Dim dr As DataRow = e.Table.Current.DataRow
Dim wz As Integer = Tables("库存管理_Table1").FindRow("_Identify=" & dr("_Identify"))
If wz >=0 Then
Tables("库存管理_Table1").Position = wz
End If
End If
End If