VB程序:else没有if

来源:百度知道 编辑:UC知道 时间:2024/05/15 09:10:30
大家帮我下哦,我做了一个VB的图书管理程序,可是在最后合成.exe文件的时候提示我else没有if .我找了下程序的源码,发现有两个FROM出错了,可是我又不知道错在哪里.把程序发上来给大家看下:
Private Sub Command3_Click()
Dim answer As String
On Error GoTo command3error
answer = MsgBox("确定要删除吗?", vbYesNo, "")
If answer = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveLast
End If
DataGrid1.Refresh
MsgBox "删除成功!", vbOKCancel + vbExclamation, ""
DataGrid1.AllowDelete = False
Else
Exit Sub
command3error:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
另一个:Private Sub Command3_Click()
Dim answer As String
On Error GoTo command3error
answer = MsgBox("确定要删除吗:", vbYesNo, "")
If answer = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
DataGrid1.Refresh
MsgBox "成功删除!", vbOKOnly + vbExclamation, ""
DataGrid1.AllowDelete

Private Sub Command3_Click()
Dim answer As String
On Error GoTo command3error
answer = MsgBox("确定要删除吗?", vbYesNo, "")
If answer = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveLast

DataGrid1.Refresh
MsgBox "删除成功!", vbOKCancel + vbExclamation, ""
DataGrid1.AllowDelete = False

End If

Exit Sub
command3error:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub

另一个:

Private Sub Command3_Click()
Dim answer As String
On Error GoTo command3error
answer = MsgBox("确定要删除吗:", vbYesNo, "")
If answer = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
DataGrid1.Refresh
MsgBox "成功删除!", vbOKOnly + vbExclamation, ""
DataGrid1.AllowDelete = False
End If
Exit Sub
command3error:
If Err.Number <