New Perspectives Access 365 | Module 11: SAM Project A Tech Builders
Building Charts and Application Parts and Importing and Exporting Data
· Excel Projects Help

GETTING STARTED
1. Save the file NP_AC365_11A_FirstLastName_1.accdb as NP_AC365_11A_FirstLastName_2.accdb
a. Edit the file name by changing “1” to “2”.
b. If you do not see the .accdb file extension, do not type it. The file extension will be added for you automatically.
2. With the file NP_AC365_11A_FirstLastName_2.accdb open, ensure that your first and last name is displayed as the first record in the _GradingInfoTable table.
a. If the table does not display your name, delete the file and download a new copy.
PROJECT STEPS
1. You work in the data division of Tech Builders which sells computer and network system hardware to a variety of companies. For high level planning purposes, you have created an Access database to track new customers, the hardware modules they have purchased, and the lead representative for each installation. In this project, you will enhance the database by creating and modifying Visual Basic for Applications(VBA). Open the RepresentativeSalary form in Design View and complete the following:
a. Open the Visual Basic Editor window.
b. Insert the following comment as the second line of the Form_Current procedure, in the line just above the If statement. 'Must reside in CAN and be a contract employee to receive travel allowance Save and close the Visual Basic Editor and save and close the RepresentativeSalary form.
2. Open the CustomerEntry form in Design View and complete the following:
a. Add a form event procedure on the On Current event with the VBA code as shown below and as in Figure 1. This procedure checks the value of the Employees field. If the value is greater than 3000, the RepresentativeMessage label is visible. If the value is less than or equal to 3000, the RepresentativeMessage label is not visible. Private Sub Form_Current() If Employees.Value 3000 Then RepresentativeMessage.Visible = True Else RepresentativeMessage.Visible = False End If End Sub
b. Save and close the VBE window, then save and open the CustomerEntry form in Form View.
c. Navigate through several records to test your procedure. Close the CustomerEntry form.
Figure 1: Form_Current VBA Procedure for the CustomerEntry Form
3. Open the RepresentativeSalary form in Design View and complete the following:
a. Add an event procedure to the After Update event of the ContractEmployee check box that tests whether the ContractEmployee Value property is True. If true, display a message box with the message: "Complete contract employee documents" as shown below and as in Figure 2. Private Sub ContractEmployee_AfterUpdate() If ContractEmployee.Value = True Then MsgBox "Complete contract employee documents" End If End Sub
b. Save and close the VBE window, then save and open the RepresentativeSalary form in Form View.
c. Click the ContractEmployee check box for the first record to test your procedure. Click OK in the message box, click the ContractEmployee check box again to uncheck it, then close the RepresentativeSalary form.
Figure 2: ContractEmployee_AfterUpdate VBA Procedure in the RepresentativeSalary Form
4. Create a new, standard module with the name of CustomFunctions and within it, create the following function as shown below and as in Figure 3. Save the CustomFunctions module. Function TravelCalc(CountryValue, SalaryValue) If CountryValue = "CAN" Then If SalaryValue 65000 Then TravelCalc = 2000 ElseIf SalaryValue 72000 Then TravelCalc = 1500 End If End If End Function
Figure 3: Travel Function VBA Code in the CustomFunctions Module
5. Create a new query in Query Design View based on the Representative table with the following instructions to test the new custom function, the TravelCalc function, as used within a query:
a. Use LastName, Reside, and Salary fields from the Representative table.
b. Create a new calculated field named TravelCost that uses the new TravelCalc function with the Reside field for the CountryValue argument and the Salary field for the SalaryValue argument.
c. Save the query with the name TravelCostCalculation and then display it in Datasheet View to test your new custom function and calculated field. Close the TravelCostCalculation query.
6. Copy the FormProcedures module and complete the following:
a. Paste it into the Navigation Pane using ReportFunctions for the name.
b. Open the ReportFunctions module in the Visual Basic Editor and delete the createNewRecord and printCurrentRecord procedures. Save and close the ReportFunctions module.
7. Convert the OpenObjects macro to VBA. Include the error handling and macro comments statements. Accept the default module name and save and close any open Visual Basic Editor or Macro Design View windows.
8. Convert the macros in the CustomerEntry form to VBA. Include the error handling and macro comments statements. Accept the default module name and save and close any open Visual Basic Editor and Form Design View windows.
Save and close any open objects in your database. Compact and repair your database, close it, and then exit Access. Follow the directions on the website to submit your completed project.
