In this project, you will add fields to a table and set data validation rules. You will also import a text file into a database, design advanced queries, and create a navigation form. Additionally, you will use SQL to modify a record source and create an embedded macro to automate opening a report. Finally, you will create a pie chart in a report.
Start Access. Open the file named Exp19_Access_AppCapstone_Comp_Drivers. Grader has automatically added your last name to the beginning of the filename. Save the file to the location where you are storing your files.
You have discovered that the insurance company data that you want is stored in an external text file, so you will import the file as a table in the database, and not need to design the table from scratch.
Create a table in the database by importing the downloaded delimited text file named Insurance_Text.txt. Use the first row of the file as field names, use InsuranceID as the primary key, and then name the table InsuranceCos_Text. Accept all other default options. Do not save the import steps.
You will modify a table to add fields that store the websites and photos of agents, add a lookup field, and set data validation to ensure that valid values are entered in a field.
Create a new field in the Agency Info table after InsPhone named Website with the Hyperlink
data type. Save the table. In Datasheet view, add the website http://William_Smith.com to the
William Smith record (Record 1).
Create a new field in the Agency Info table after Website named AgentPhoto with the Attachment data type. Save the table. In Datasheet view for Record 1 (William Smith), add the downloaded picture file named WmSmith.jpg to the AgentPhoto field.
Set the validation rule of the InsuranceCo field to accept the values AS, NAT, or SF only. Set the validation text to read Please enter AS, NAT, or SF. (include the period).
Make InsuranceCo a lookup field in the Agency Info table. Set the lookup to get values from the InsuranceID field in the InsuranceCos_Text table. Accept all other defaults and save the table. In Datasheet view, select the first InsuranceCo value, type AT and press ENTER. Click OK in the message box, press ESC, and then close the table.
You will create queries to locate records that have missing values, update values in a table, and delete specific records from the database.
Create a new query using Design view. From the Insurance table, add the DriverID, AutoType, TagID, and TagExpiration fields (in that order). Save the query as Missing Tag Dates.
Set the criteria in the TagExpiration field to find null values. Run the query (two records will display). Save and close the query.
Create a new query using Design view. From the Drivers table, add the Class field. Change the query type to Update and set the criteria to update drivers whose class is Minor to Junior. Run the query (eight records will update). Run the query again and note that there are no records to update. Save the query as Driver Class_Update and close the query. View the updates in the Drivers table and close the table.
Create a new query using Design view. From the Drivers table, add the Class field. Save the query as Driver Class_Delete.
Change the query type to Delete and set the criteria to delete drivers whose class is Special. Run the query (one record will be deleted). Save and close the query. View the changes in the Drivers table and close the table.
Create a new query using Design view. From the Insurance table, add the InsuranceAgentID, AutoType, AutoYear, and TagID fields (in that order). Save the query as Agent_Parameter.
Set the criteria in the InsuranceAgentID field to display the prompt as Enter the Agent ID: and run the query. In the parameter prompt, enter AS8842 and click OK to view the results (two records). Save and close the query.
The Performance Analyzer makes suggestions as to how a selected table can be made more efficient or to work better with other tables in the database.
Use the Analyze Performance tool to analyze the Drivers table. Note the idea to change the data type of the Weight field from Short Text to Long Integer. In the Drivers table, set the data type of the Weight field to Number (Long Integer), then save and close the table.
A navigation form enables users to select key objects in the database in a user-friendly manner. The form will launch automatically to present the frequently used forms and report to the end users.
Create a Navigation form based on the Vertical Tabs, Left template. Drag and drop the Drivers form onto the first tab of the form. Drop the Insurance form onto the second tab.
Drag and drop the Drivers report onto the third tab of the Navigation form. View the form in Form view, click each of the tabs, and then save the form as Navigator. Close the form.
Set the option in the database so that the Navigator form launches automatically when the database opens. Close the database and reopen it to ensure that the Navigator form opens. Close the form.
You will modify the record source of a report to display specific records. The report will not rely on an underlying query to select records; the criteria are handled by the SQL statement. You will add a command button to a form that will open a form with associated records.
Open the Drivers report in Design view. Modify the record source of the report using a SQL statement to select all Drivers records with a Class of Adult. Print Preview the report (eight records will display).
Modify the SQL record source to display Junior drivers. Print Preview the report (eight records will display). Save and close the report.
You will add a command button to a form that will open a form with associated records.
Open the Drivers form in Design view, click to add a command button at the intersection of the 6-inch mark on the horizontal ruler and the 3-inch mark on the vertical ruler.
Set the command button to open the Insurance form. Use the default picture as the button. Set the name and the caption of the button to Open Insurance Form. Set the width of the button to 1.5″. Save the form. View the form in Form view and click the command button.
You will create a chart in a report that compares the number of licenses that were issued by year. The chart will graphically depict the mix of drivers according to the years of driving experience.
Open the Auto Year report in Design view. Click the Report Footer section bar. Open the Property Sheet and set the height of the Report Footer section to 3″. Close the Property Sheet. Click in the blank space below the Count function.
Insert a pie chart by clicking at the 0.5″ mark on the vertical ruler and the 2.5″ mark on the horizontal ruler. In the Chart Settings pane, set the Auto Year_Parameter query as the data source. In the Axis (Category), select the AutoType check box, then in the parameter prompt, type 2012. Close the Chart Settings pane.
Click in the Chart Title box in the Property Sheet, and type Auto Type. Close the Property sheet, then save and close the report. Reopen the report and type 2010 at the prompts. Note that the data in the report and chart displays according to the year input. Close the report.