设为首页   |  加入收藏夹 快速导航:  热门文章  |  最新文章  |  梦想博客  
当前位置:编程之家 -> 文章频道 ->vb 
站内搜索:  

VB+Access设计图书管理系统(11)

作者:不详 来源:csdn 整理日期:2007-02-19


  以下为窗体的代码:

  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()

  On Error GoTo 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 Command3_Click()

  Adodc1.Recordset.MovePrevious

  If Adodc1.Recordset.BOF Then

  MsgBox "这是第一条记录", vbOKCancel + vbQuestion

  Adodc1.Recordset.MoveFirst

  End If

  End Sub

  Private Sub Command4_Click()

  Adodc1.Recordset.MoveNext

  If Adodc1.Recordset.EOF Then

  MsgBox "这是最后一条记录", vbOKCancel + vbQuestion

  Adodc1.Recordset.MoveLast

  End If

  End Sub

  Private Sub Command5_Click()

  If Adodc1.Recordset.EOF Then

  MsgBox "记录空", vbOKCancel + vbQuestion

  End

  Else

  Adodc1.Recordset.MoveFirst

  End If

  Exit Sub

  End Sub

  Private Sub Command6_Click()

  If Adodc1.Recordset.RecordCount = 0 Then

  MsgBox "空记录", vbOKCancel + vbQuestion

  End

  Else

  Adodc1.Recordset.MoveLast

  End If

  End Sub

  Private Sub Command7_Click()

  MDIForm1.Show

  frmtousu.Hide

  End Sub

  到这里,各个窗体的界面和代码都介绍完了。发布后可以作为一个实际的项目应用。
[1]  [2]  [3]  [4]  [5]  [6]  [7]  [8]  [9]  [10]  [11]