现在的问题是点击按钮后,文本控件启用了,但没有正常加入行,这又是哪儿不对呢?
If Tables("InfoBranchDepartment_TableBD").Rows.Count = 0 Then '如果是一个空表
Tables("InfoBranchDepartment_TableBD").AddNew()
Else
Dim r As Row = Tables("InfoBranchDepartment_TableBD").Rows(Tables("InfoBranchDepartment_TableBD").Rows.Count - 1)'获得最后一行
If r.Isnull("Code") OrElse r.Isnull("Name") Then
e.Form.Controls("BntSave").Enabled = True
End If
'如果当前行code必填列是空,禁止增加行
If Tables("InfoBranchDepartment_TableBD").Current.Isnull("Code") Then
Tables("InfoBranchDepartment_TableBD").AllowAddNew = False
Functions.Execute("MessageBox","""编码""是必填项"," Prompt","OK", "Information")
ElseIf Tables("InfoBranchDepartment_TableBD").Current.Isnull("Name") Then
Tables("InfoBranchDepartment_TableBD").AllowAddNew = False
Functions.Execute("MessageBox","""名称""是必填项"," Prompt","OK", "Information")
Else
Tables("InfoBranchDepartment_TableBD").AddNew()
End If
End If
'启用控件
e.Form.Controls("TbxCode").Enabled = True
e.Form.Controls("TbxName").Enabled = True
e.Form.Controls("CbxQuality").Enabled = True
e.Form.Controls("TbxInCharge").Enabled = True
e.Form.Controls("TbxSuperior").Enabled = True
e.Form.Controls("TbxTelephone").Enabled = True
e.Form.Controls("TbxAddress").Enabled = True
e.Form.Controls("TbxEmail").Enabled = True
e.Form.Controls("TbxMobileNo").Enabled = True
[此贴子已经被作者于2015/6/18 17:49:04编辑过]