编译错误,标签未定义
自己做一个管理系统,建的是ACCESS数据库。控件有:command1查找,command2退出,command3新增,command4保存,command4删除,data1.代码如下:
'添加记录
Private Sub command3_Click()
If Command3.Caption = "确定" Then
On Error GoTo errorhandler
Data1.UpdateRecord
Data1.Recordset.MoveLast
Command5.Enabled = True
command1.Enabled = True
Command3.Caption = "添加"
Else
Data1.Recordset.AddNew
Command3.Caption = "确定"
Command5.Enabled = False
Command3.Enabled = False
End If
End Sub
'错误处理
errorhandler:
If Err.Number = 524 Then
msqbox "该记录已存在!", 48, "警告" '输入的姓名相同
End If
Resume
End Sub
'删除记录
Private Sub command5_click()
Dim i As Integer
i = MsgBox("真的要删除记录吗?", 52, "警告")
If i = 6 Then
Data1.Recordset.Delete
Data1.Refresh
End If
End Sub
运行前3句
Private Sub command3_Click()
If Command3.Caption = "确定" Then
On Error GoTo errorhandler
就提示:编译错误,标签未定义
请教怎样定义[新增]控件