1、Private Sub CmdAdd_Click()
On Error GoTo Err_CmdAdd_Click
Dim sql As String
If IsNull(Me.AddNew) Then
MsgBox ("lease input operator!")
Else
sql = "insert into [tabOperator] ([operator]) values ('" & Me.AddNew & "')"
DoCmd.RunSQL sql
Me.MemList.Requery
Me.AddNew = Null
End If
Exit_CmdAdd_Click:
Exit Sub
Err_CmdAdd_Click:
MsgBox Err.Description
Resume Exit_CmdAdd_Click
End Sub
2、Private Sub CmdAdd_Click()
Dim sql As String
If IsNull(Me.AddNew) Then
MsgBox ("lease input operator!")
Else
DoCmd.SetWarnings False
sql = "insert into [tabOperator] ([operator]) values ('" & Me.AddNew & "')"
DoCmd.RunSQL sql
Me.MemList.Requery
Me.AddNew = Null
DoCmd.SetWarnings True
End If
End Sub