老师,以下是表StartEdit事件的代码,在执行时,如果状态列是“解锁”,且操作人为经办人时,“选择”列是可以编辑的,这个没问题,但如果状态列为“锁定”或者“审核”有值或“上报确认为”有值时,“选择”列是不可编辑,这样的话如果想解锁,则无解,因为不能选择要解锁的行。我试了很多办法,都不成,请老师帮忙。
1、StartEdit事件的代码,
If e.Col.name <> "选择" OrElse e.Col.name <> "锁定" Then
If e.Row("状态") = "锁定"
e.cancel = True
MessageBox.Show("数据已被锁定,不可编辑!")
ElseIf e.Row("状态") = "解锁" OrElse e.Row("状态") = Nothing
If e.Row.isnull("审核") = False
e.cancel = True
MessageBox.Show("数据已审核上报,不可编辑!")
ElseIf e.Row.isnull("上报确认") = False
e.cancel = True
MessageBox.Show("数据已上报,请先取消上报!")
If user.name <> e.Row("经办人") Then
e.cancel = True
Else
e.cancel = False
End If
End If
End If
End If
2、PrepareEdit事件的代码
If e.Row("管理单位") <> user.GROUP AndAlso e.Row("经办人") <> user.NAME AndAlso user.GROUP <> "高科控股集团" AndAlso user.NAME <> "管理员" AndAlso user.NAME <> "开发者" Then
If e.Col.name <> "选择" Then
e.Cancel = True
End If
End If
3、菜单中“删除行”按钮的代码如下,无论“选择”是否勾选,都会按行提示信息。
For Each r As Row In CurrentTable.Rows
If CurrentTable.Current("XZH") = True Then
If R("状态") = "锁定"
MessageBox.Show("数据已被锁定,不可删除!")
Else If R("状态") = "解锁"
If R.isnull("审核") = False
MessageBox.Show("数据已审核上报,不可删除!")
ElseIf R.isnull("上报确认") = False
MessageBox.Show("数据已上报,不可删除!")
Else
If user.name = R("经办人") Then
Syscmd.Row.Delete()
Else
MessageBox.show("你没有删除数据的权限!")
End If
End If
End If
End If
Next
[此贴子已经被作者于2015/12/29 0:22:34编辑过]