• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. VBA 101: The Basics of VBA > Practical Examples: Event Routines, Use...

Practical Examples: Event Routines, User-Defined Functions, and Subroutines Needed for the Time and Billing Application

This example uses a form, a query, and a report to retrieve criteria and then preview sales information by client for a specific date range. The rptClientInformationByProject report is based on a query called qryBillingDetailByClient; this query requires information from a form named frmPrintClientBilling. The frmPrintClientBilling form, shown in Figure 8.16, must be open for the process to finish successfully because the criteria for the query is gathered from the report. The code for the two command buttons looks like this:

Sub cmdRunReport_Click()
   If IsNull(Me!txtStartDate) Or IsNull(Me!txtEndDate) Then
      MsgBox "Both the Start Date and End Date Must Be Filled In"
   Else
      Call RunReport("rtpClientInformationByProject")
   End If
End Sub

Sub cmdClose_Click()
    DoCmd.Close
End Sub


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint