1Ʒ¼롱ĳ

Option Compare Database
Option Explicit
Private Sub Text19_AfterUpdate()
On Error GoTo Err_Text19_AfterUpdate
    Me![].SetFocus
    DoCmd.FindRecord Me![Text19], , True, , True
    If Me![] <> Me![Text19] Then
    If MsgBox("һƷ", vbOKCancel, "ȷ") = vbOK Then
    DoCmd.GoToRecord , , acNewRec
    Me![] = Me![Text19]
    Me![] = 0
            Else
                Exit Sub
            End If
    End If
    Me![Text21] = Me![]
    Me![Text25] = Me![]
    Me![Text27] = 0
    Me.Refresh
Exit_Text19_AfterUpdate:
    Exit Sub
Err_Text19_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_Text19_AfterUpdate
End Sub
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
    Me![] = Me![Text21]
    Me![] = Me![] + Me![Text27]
    Me![] = Me![Text25]
    Me![] = Me![] * Me![]
    Me![ջ] = Me![Combo41]
    Me![] = Me![Combo45]
    Me![] = Me![Text29]
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.Refresh
Exit_Command35_Click:
    Exit Sub
Err_Command35_Click:
    MsgBox Err.Description
    Resume Exit_Command35_Click
End Sub
Private Sub Command47_Click()
On Error GoTo Err_Command47_Click
    DoCmd.Close
Exit_Command47_Click:
    Exit Sub
Err_Command47_Click:
    MsgBox Err.Description
    Resume Exit_Command47_Click
End Sub
2Ʒݲѯĳ
Option Compare Database
Option Explicit
Private Sub Combo41_LostFocus()
On Error GoTo Err_Combo41_LostFocus
    Me![ջ].SetFocus
DoCmd.FindRecord Me![Combo41], , True, , True
    Me![Command49].Visible = True
Exit_Combo41_LostFocus:
    Exit Sub
Err_Combo41_LostFocus:
    MsgBox Err.Description
    Resume Exit_Combo41_LostFocus
End Sub
Private Sub Combo45_LostFocus()
On Error GoTo Err_Combo45_LostFocus
    Me![].SetFocus
DoCmd.FindRecord Me![Combo45], , True, , True
    Me![Command49].Visible = True
Exit_Combo45_LostFocus:
    Exit Sub
Err_Combo45_LostFocus:
    MsgBox Err.Description
    Resume Exit_Combo45_LostFocus
End Sub
Private Sub Command47_Click()
On Error GoTo Err_Command47_Click
    DoCmd.Close
Exit_Command47_Click:
    Exit Sub
Err_Command47_Click:
    MsgBox Err.Description
    Resume Exit_Command47_Click
End Sub
Private Sub Text19_LostFocus()
    Me![].SetFocus
DoCmd.FindRecord Me![Text19], , True, , True
End Sub
Private Sub Command49_Click()
On Error GoTo Err_Command49_Click
    Screen.PreviousControl.SetFocus
    DoCmd.FindNext
Exit_Command49_Click:
    Exit Sub
Err_Command49_Click:
    MsgBox Err.Description
    Resume Exit_Command49_Click
End Sub
Private Sub Text25_LostFocus()
On Error GoTo Err_Text25_LostFocus
    Me![].SetFocus
DoCmd.FindRecord Me![Text25], , True, , True
    Me![Command49].Visible = True
Exit_Text25_LostFocus:
    Exit Sub
Err_Text25_LostFocus:
    MsgBox Err.Description
    Resume Exit_Text25_LostFocus
End Sub
Private Sub Text27_LostFocus()
On Error GoTo Err_Text27_LostFocus
    Me![].SetFocus
DoCmd.FindRecord Me![Text27], , True, , True
    Me![Command49].Visible = True
Exit_Text27_LostFocus:
    Exit Sub
Err_Text27_LostFocus:
    MsgBox Err.Description
    Resume Exit_Text27_LostFocus
End Sub
Private Sub Text29_LostFocus()
On Error GoTo Err_Text29_LostFocus
    Me![].SetFocus
DoCmd.FindRecord Me![Text29], , True, , True
    Me![Command49].Visible = True
Exit_Text29_LostFocus:
    Exit Sub
Err_Text29_LostFocus:
    MsgBox Err.Description
    Resume Exit_Text29_LostFocus
End Sub
Private Sub Text50_LostFocus()
On Error GoTo Err_Text50_LostFocus
    Me![].SetFocus
DoCmd.FindRecord Me![Text50], , True, , True
    Me![Command49].Visible = True
Exit_Text50_LostFocus:
    Exit Sub
Err_Text50_LostFocus:
    MsgBox Err.Description
    Resume Exit_Text50_LostFocus
End Sub
Private Sub Text52_LostFocus()
On Error GoTo Err_Text52_LostFocus
    Me![λ].SetFocus
DoCmd.FindRecord Me![Text52], , True, , True
    Me![Command49].Visible = True
Exit_Text52_LostFocus:
    Exit Sub
Err_Text52_LostFocus:
    MsgBox Err.Description
    Resume Exit_Text52_LostFocus
End Sub
Private Sub Text54_LostFocus()
On Error GoTo Err_Text54_LostFocus
    Me![].SetFocus
DoCmd.FindRecord Me![Text54], , True, , True
    Me![Command49].Visible = True
Exit_Text54_LostFocus:
    Exit Sub
Err_Text54_LostFocus:
    MsgBox Err.Description
    Resume Exit_Text54_LostFocus
End Sub
3ƷϹݲѯĳ
Option Compare Database
Option Explicit
Private Sub Form_Open(Cancel As Integer)
Me![Text52] = 0
Me![Text54] = 0#
End Sub
Private Sub Text19_AfterUpdate()
On Error GoTo Err_Text19_AfterUpdate
    Me![].SetFocus
    DoCmd.FindRecord Me![Text19], , True, , True
    If Me![] <> Me![Text19] Then
            If MsgBox("", vbOKCancel, "") = vbOK Then
                Me![Text19].SetFocus
                Else
                Me![Text19].SetFocus
            End If
    Else
    Me![Text21] = Me![]
    Me![Text25] = Me![]
    Me![Text27] = 0
    Me.Refresh
    Me![ݼ¼Ӵ].SetFocus
    DoCmd.FindRecord Me![Text19], , True, , True
    Me![Text27].SetFocus
    End If
Exit_Text19_AfterUpdate:
    Exit Sub
Err_Text19_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_Text19_AfterUpdate
End Sub
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
    Me![ݼ¼Ӵ].SetFocus
    DoCmd.FindRecord Me![Text19], , True, , True
    If Me![ݼ¼Ӵ]![] <> Me![Text19] Then
        DoCmd.GoToRecord , , acNewRec
        Me![ݼ¼Ӵ]![] = 0
        Me![ݼ¼Ӵ]![] = 0#
    End If
    Me![ݼ¼Ӵ]![] = Me![Text19]
    Me![ݼ¼Ӵ]![] = Me![Text21]
    Me![ݼ¼Ӵ]![λ] = Me![λ]
    Me![ݼ¼Ӵ]![۵] = Me![Text25]
    Me![ݼ¼Ӵ]![] = Me![Text27] + Me![ݼ¼Ӵ]![]
    Me![ݼ¼Ӵ]![] = Me![Text25] * Me![ݼ¼Ӵ]![]
    Me![ݼ¼Ӵ]![Ϲ] = Me![Text29]
    Me![ݼ¼Ӵ]![ӪҵԱ] = Me![Combo45]
    Me![ݼ¼Ӵ]![Ϲ] = Me![Combo58]
    Me![Text52] = Me![Text52] + Me![Text27]
    Me![Text54] = Me![Text54] + Me![Text27] * Me![Text25]
    Me![] = Me![] - Me![Text27]
    Me![] = Me![] * Me![]
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.Refresh
Exit_Command35_Click:
    Exit Sub
Err_Command35_Click:
    MsgBox Err.Description
    Resume Exit_Command35_Click
End Sub
Private Sub Command47_Click()
On Error GoTo Err_Command47_Click
    DoCmd.Close
Exit_Command47_Click:
    Exit Sub
Err_Command47_Click:
    MsgBox Err.Description
    Resume Exit_Command47_Click
End Sub
4¼롱ĳ
Option Compare Database
Option Explicit
Private Sub Combo45_AfterUpdate()
Me.Refresh
End Sub
Private Sub Form_Open(Cancel As Integer)
Me![Text52] = 0
Me![Text54] = 0#
End Sub
Private Sub Text19_AfterUpdate()
    Me![].SetFocus
DoCmd.FindRecord Me![Text19], , True, , True
    If Me![] <> Me![Text19] Then
            If MsgBox("", vbOKCancel, "") = vbOK Then
                Me![Text19].SetFocus
                Else
                Me![Text19].SetFocus
            End If
    Else
    Me![Text21] = Me![]
    Me![Text25] = Me![۵]
    Me![Text27] = 0
    Me.Refresh
    Me![Text27].SetFocus
    End If
End Sub
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
Me![Text52] = 0
Me![Text54] = 0#
    Me.Refresh
Exit_Command35_Click:
    Exit Sub
Err_Command35_Click:
    MsgBox Err.Description
    Resume Exit_Command35_Click
End Sub
Private Sub Command47_Click()
On Error GoTo Err_Command47_Click
    DoCmd.Close
Exit_Command47_Click:
    Exit Sub
Err_Command47_Click:
    MsgBox Err.Description
    Resume Exit_Command47_Click
End Sub
Private Sub Text27_LostFocus()
If Me![Text27] <> 0 Then
    Me![ݼ¼ѯӴ].SetFocus
    DoCmd.GoToRecord , , acNewRec
    Me![ݼ¼ѯӴ]![] = Me![Text19]
    Me![ݼ¼ѯӴ]![] = Me![Text21]
    Me![ݼ¼ѯӴ]![λ] = Me![λ]
    Me![ݼ¼ѯӴ]![۵] = Me![۵]
    Me![ݼ¼ѯӴ]![] = Me![Text27]
    Me![ݼ¼ѯӴ]![۽] = Me![Text27] * Me![۵]
    Me![ݼ¼ѯӴ]![] = Me![Text29]
    Me![ݼ¼ѯӴ]![Ա] = Me![Combo45]
    Me![] = Me![] - Me![Text27]
    Me![] = Me![۵] * Me![]
    Me![Text52] = Me![Text52] + Me![Text27]
    Me![Text54] = Me![Text54] + Me![Text27] * Me![۵]
End If
End Sub
5Ӱת塱ĳ
Option Compare Database
Option Explicit
Private Sub Combo45_AfterUpdate()
Me.Refresh
End Sub
Private Sub Command60_Click()
On Error GoTo Err_Command60_Click
    DoCmd.Close
Exit_Command60_Click:
    Exit Sub
Err_Command60_Click:
    MsgBox Err.Description
    Resume Exit_Command60_Click
End Sub
Private Sub Command61_Click()
On Error GoTo Err_Command61_Click
    Dim stDocName As String
    stDocName = "۽Ӱ౨"
    DoCmd.OpenReport stDocName, acPreview
Exit_Command61_Click:
    Exit Sub
Err_Command61_Click:
    MsgBox Err.Description
    Resume Exit_Command61_Click
End Sub
6ҵѯܡĳ
Option Compare Database
Option Explicit
Private Sub Command60_Click()
On Error GoTo Err_Command60_Click
    DoCmd.Close
Exit_Command60_Click:
    Exit Sub
Err_Command60_Click:
    MsgBox Err.Description
    Resume Exit_Command60_Click
End Sub
Private Sub Text29_AfterUpdate()
On Error GoTo Err_Text29_AfterUpdate
Me.Refresh
Exit_Text29_AfterUpdate:
    Exit Sub
Err_Text29_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_Text29_AfterUpdate
End Sub
Private Sub Text67_AfterUpdate()
On Error GoTo Err_Text67_AfterUpdate
Me.Refresh
Exit_Text67_AfterUpdate:
    Exit Sub
Err_Text67_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_Text67_AfterUpdate
End Sub
Private Sub Command71_Click()
On Error GoTo Err_Command71_Click
    Dim stDocName As String
    stDocName = "ҵѯ"
    DoCmd.OpenReport stDocName, acPreview
Exit_Command71_Click:
    Exit Sub
Err_Command71_Click:
    MsgBox Err.Description
    Resume Exit_Command71_Click
End Sub
7СƷϢϵͳĳ
Option Compare Database
Option Explicit
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Ʒ¼"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command2_Click:
    Exit Sub
Err_Command2_Click:
    MsgBox Err.Description
    Resume Exit_Command2_Click
End Sub
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Ʒݲѯ"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command3_Click:
    Exit Sub
Err_Command3_Click:
    MsgBox Err.Description
    Resume Exit_Command3_Click
End Sub
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "ƷϹ¼"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command4_Click:
    Exit Sub
Err_Command4_Click:
    MsgBox Err.Description
    Resume Exit_Command4_Click
End Sub
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "ҵѯ"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command5_Click:
    Exit Sub
Err_Command5_Click:
    MsgBox Err.Description
    Resume Exit_Command5_Click
End Sub
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Ӱת"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command6_Click:
    Exit Sub
Err_Command6_Click:
    MsgBox Err.Description
    Resume Exit_Command6_Click
End Sub
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "¼"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command7_Click:
    Exit Sub
Err_Command7_Click:
    MsgBox Err.Description
    Resume Exit_Command7_Click
End Sub
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click
    DoCmd.Close
Exit_Command8_Click:
    Exit Sub
Err_Command8_Click:
    MsgBox Err.Description
    Resume Exit_Command8_Click
End Sub

8ͼӱԴ
ͼӱԴһSQL䣬ͨ趨SQL䣬Ϊͼ趨Դ

SELECT ҵѯ.Ա, Sum(ҵѯ.۽) AS ۽֮
FROM ҵѯ
GROUP BY ҵѯ.Ա;






