You are on page 1of 11

CREATING A MAIN

MENU
Connecting Add or edit a forms
Print or preview a range of reports
VB Code for Radio Buttons and the frame

Private Sub studentFrame_Click()


If studentFrame.Value = 1 Then
DoCmd.OpenForm "frmStudent1_Automated"
Else
DoCmd.OpenForm "frmEditStudent_Automated"
End If
End Sub
Adding Command Buttons to link the forms

1. Using the wizard


2. The VB code to make sure there is at least one student record
before opening the form

Private Sub cmdEditStudent_Click()


If dcount("*", "tblStudent") > 0 Then
DoCmd.OpenForm "frmEditStudent_Automated"
Else
MsgBox "There are no students to edit", vbOKOnly
End If
End Sub
3. Embedded macro to make sure there is at least one student
record before opening the form
Report Options

1. VB Code for View/Print the Reports

Private Sub cmdAmountOutstanding_Click()


If MsgBox("Click YES to view the report before printing it?",
vbYesNo) = vbNo Then
DoCmd.PrintOut '"rptAmountOutstanding", acViewNormal
Else
DoCmd.OpenReport "rptAmountOutstanding", acViewPreview
End If
End Sub
2. Macro for View/Print the Reports

Private Sub cmdPrintInstalmentChart_Click()


If dcount("*", "qryChart1") > 0 Then
If MsgBox("Click YES to view the chart before printing it?",
vbYesNo) = vbNo Then
DoCmd.OpenReport "rptChart1", acViewNormal
Else
DoCmd.OpenReport "rptChart1", acViewPreview
End If
Else
MsgBox "There are no payment instalment choices", vbOKOnly
End If
End Sub
Exporting Files in different formats

1. As an Excel file
2. In PDF format

You might also like