Private Sub CommandButton2_Click()
Dim control As control
For Each control In UserForm1.Controls
If TypeOf control Is TextBox Then
If control.Text = "" Then
MsgBox "参数不能为空,请重新输入!", vbCritical
Exit Sub
End If
End If
Next
On Error GoTo errHandle
With rsta
.AddNew
.Fields(0) = TextBox1.Text
.Fields(1) = TextBox2.Text
.Update
End With
Exit Sub
errHandle:
If Err.Number = -2147467259 Then
MsgBox "首先修改文本框中的数值,然后单击“添加”按钮,完成添加操作。", vbCritical
End If
Err.Clear