发布网友 发布时间:2024-12-15 14:05
共1个回答
热心网友 时间:2024-12-18 18:18
Private Sub Command1_Click()
On Error GoTo deleteerr'错误捕获,到deleteerr行
With Adodc1.Recordset
If Not .EOF And Not .BOF Then‘判断是否有数据记录
If MsgBox("删除当前记录吗?", vbYesNo + vbQuestion) = vbYes Then’确认是否删除记录
.Delete '删除当前行记录
.MoveNext‘移动到下一条记录
If .EOF Then .MoveLast’如果到达记录结尾,将指针移动到最后一条记录
End If
End If
End With
Exit Sub‘退出过程
deleteerr:
MsgBox Err.Description’显示错误信息
End Sub
Private Sub Command2_Click()
Unload Me‘卸载窗体
End Sub
Private Sub Form_Paint()
Me.PaintPicture Me.Picture, 0, 0, ScaleWidth, ScaleHeight‘加载窗体时调整背景图片大小
End Sub
Private Sub Command1_Click()
On Error GoTo adderr
Text1.SetFocus’文本框获得焦点
Adodc1.Recordset.AddNew‘数据控件增加记录
Exit Sub
adderr:
MsgBox Err.Description’显示错误信息
End Sub
Private Sub Command2_Click()
Unload Me‘卸载窗体
End Sub
Private Sub Form_Paint()
Me.PaintPicture Me.Picture, 0, 0, ScaleWidth, ScaleHeight
End Sub