If e.Col.Name = "第三列" Then
If e.Row("第三列") = 0 Then
e.Row("第三列") = Nothing
Else If Tables("表A").Rows(0)("第三列")=Nothing Then '判断是否是从第一行输入
MessageBox.Show("必须从第一行录入")
e.Row("第三列")=Nothing
Else
Dim i As Integer
If e.Row.Index >0 Then
i=e.Row.Index-1
If e.Row("第三列") < Tables("表A").Rows(i)("第三列") Then '小于则
MessageBox.Show("小于上一行")
e.Row("第三列")=Nothing
Else If e.Row("第三列")-Tables("表A").Rows(i)("第三列") >1 Then '大于则
MessageBox.Show("大于上一行 +1")
e.Row("第三列")=Nothing
End If
End If
End If
End If
AfterEdit后面
[此贴子已经被作者于2011-8-22 16:23:37编辑过]