Dim Count As Integer = DataTables("明细表").Compute("Count(状态)","状态 = 0")
Dim TB As Table = Tables("明细表")
Dim drs As List(Of DataRow)
drs = DataTables("明细表").Select("[姓名] ='"& TB.Current("姓名") &"'")
If e.Form.Opened And Count > 0 Then
For Each dr As DataRow In drs
dr("状态") = True
dr.Locked = True
Next
End If
Tables("明细表").ApplyFilter = False
DataTables("明细表").Save()
e.Form.Close()
代码在按钮里面,当"明细表"没有符合条件的行时出现错误提示。
[此贴子已经被作者于2013-3-6 11:38:30编辑过]