【圖書館借閱管理信息系統(tǒng)】-Access數(shù)據(jù)庫(kù)系統(tǒng)設(shè)計(jì)制作實(shí)例(制作過程全稱錄制

主界面
Option Compare Database
Option Explicit
?
Private Sub Command2_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "數(shù)據(jù)管理", acNormal
End Sub
?
Private Sub Command3_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "數(shù)據(jù)操作", acNormal
End Sub
?
Private Sub Command4_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "數(shù)據(jù)查詢", acNormal
End Sub
?
Private Sub Command6_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "系統(tǒng)設(shè)置", acNormal
End Sub
?
Private Sub Command7_Click()
Application.Quit acQuitSaveAll
End Sub
借書
Option Compare Database
Option Explicit
?
Private Sub Command查找_Click()
Me.借書讀者信息子窗體.Requery
End Sub
借書(圖書)
Option Compare Database
Option Explicit
?
Private Sub Command查詢_Click()
Me.借書_圖書信息子窗體.Requery
End Sub
?
Private Sub Command借書_Click()
On Error GoTo 借書失敗錯(cuò)誤
If Nz(DCount("讀者編號(hào)", "讀者", "讀者編號(hào)=" & Forms("借書").借書讀者編號(hào) & ""), 0) = 0 Then
MsgBox "未找到該讀者編號(hào)!"
Exit Sub
End If
If Nz(DCount("圖書編號(hào)", "圖書", "圖書編號(hào)='" & Me.借書圖書編號(hào) & "'"), 0) = 0 Then
MsgBox "未找到該圖書編號(hào)!"
Exit Sub
End If
Dim now借書數(shù)量 As Long
now借書數(shù)量 = Nz(DLookup("借出數(shù)量", "圖書", "圖書編號(hào)='" & Me.借書圖書編號(hào) & "'"), 0)
If now借書數(shù)量 = Nz(DLookup("圖書總數(shù)", "圖書", "圖書編號(hào)='" & Me.借書圖書編號(hào) & "'"), 0) Then
MsgBox "該圖書已全部借書!"
Exit Sub
End If
Dim now當(dāng)前借書 As Long
now當(dāng)前借書 = Nz(DLookup("當(dāng)前借書", "讀者", "讀者編號(hào)=" & Forms("借書").借書讀者編號(hào) & ""), 0)
If now當(dāng)前借書 = Nz(DLookup("限借冊(cè)數(shù)", "讀者可借圖書查詢", "讀者編號(hào)=" & Forms("借書").借書讀者編號(hào) & ""), 0) Then
MsgBox "超出可借數(shù)量!"
Exit Sub
End If
DoCmd.SetWarnings (False)
DoCmd.OpenQuery "借書圖書更新查詢"
DoCmd.OpenQuery "讀者借書更新查詢"
DoCmd.OpenQuery "圖書借閱記錄追加查詢"
?
?
MsgBox "借書成功!"
Exit Sub
借書失敗錯(cuò)誤:
MsgBox "借書失敗!"
End Sub
圖書查詢
Option Compare Database
Option Explicit
?
Private Sub Command查詢_Click()
Me.圖書條件查詢列表.Requery
End Sub
數(shù)據(jù)操作
Option Compare Database
Option Explicit
?
?
Private Sub Command5_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "主界面", acNormal
End Sub
數(shù)據(jù)查詢
Option Compare Database
Option Explicit
?
?
?
Private Sub Command6_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "主界面", acNormal
End Sub
數(shù)據(jù)管理
Option Compare Database
Option Explicit
?
?
?
Private Sub Command2_Click()
DoCmd.OpenForm "圖書管理", acNormal
End Sub
?
Private Sub Command3_Click()
DoCmd.OpenForm "讀者列表", acNormal
End Sub
?
Private Sub Command4_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "主界面", acNormal
End Sub
系統(tǒng)設(shè)置
Option Compare Database
Option Explicit
?
Private Sub Command7_Click()
Application.Quit acQuitSaveAll
End Sub
?
Private Sub Command5_Click()
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "主界面", acNormal
End Sub
續(xù)借
Option Compare Database
Option Explicit
?
Private Sub Command查詢_Click()
Me.續(xù)借信息子窗體.Requery
End Sub
?
Private Sub Command續(xù)借_Click()
On Error GoTo 續(xù)借失敗錯(cuò)誤
?
DoCmd.SetWarnings (False)
DoCmd.OpenQuery "續(xù)借圖書借閱更新查詢"
?
MsgBox "續(xù)借成功!"
?
DoCmd.Close acForm, Me.Name
Exit Sub
續(xù)借失敗錯(cuò)誤:
MsgBox "續(xù)借失?。?#34;
End Sub
續(xù)借信息子窗體
讀者列表
Option Compare Database
Option Explicit
?
Private Sub 讀者編號(hào)_DblClick(Cancel As Integer)
DoCmd.OpenForm "讀者管理", acNormal, , "讀者編號(hào)=" & Me.讀者編號(hào)
DoCmd.Close acForm, "讀者列表"
End Sub
讀者查詢
Private Sub Command查詢_Click()
Me.讀者條件查詢數(shù)據(jù)表.Requery
End Sub
還書
Option Compare Database
Option Explicit
?
Private Sub Command查詢_Click()
Me.還書信息子窗體.Requery
Dim now超期天數(shù) As Long
now超期天數(shù) = Nz(DLookup("逾期天數(shù)", "借書天數(shù)逾期查詢", "讀者編號(hào)=" & Me.還書讀者編號(hào) & " and 圖書編號(hào)='" & Me.還書圖書編號(hào) & "'"), 0)
If now超期天數(shù) > 0 Then
Me.超期天數(shù) = now超期天數(shù)
Else
Me.超期天數(shù) = 0
End If
End Sub
?
Private Sub Command還書_Click()
On Error GoTo 還書失敗錯(cuò)誤
DoCmd.SetWarnings (False)
DoCmd.OpenQuery "還書圖書更新查詢"
DoCmd.OpenQuery "讀者還書更新查詢"
DoCmd.OpenQuery "圖書借閱記錄更新查詢"
?
?
MsgBox "還書成功!"
DoCmd.Close acForm, Me.Name
Exit Sub
還書失敗錯(cuò)誤:
MsgBox "還書失??!"
End Sub
?