Access 2010 Advanced
description
Transcript of Access 2010 Advanced
-
Microsoft 2010 Access Advanced
April 2011
-
Files used in this class: Advanced2011.accdb Contacts.xls Database1.accdb MyDatabase.accdb Staff.csv
-
Table of Contents
Primary Keys ............................................................................... 4 Defining a Primary Key ........................................................................ 4
Relationships ............................................................................... 5 Table relationships ............................................................................. 5 One-to-many Relationship..................................................................... 5 Many-to-many relationship .................................................................... 5 One-to-one relationships ...................................................................... 5 Creating relationships between tables ...................................................... 5 Edit a Relationship .............................................................................. 8 Join Type ......................................................................................... 9 Referential integrity ............................................................................. 9 Cascade options .............................................................................. 10 Deleting relationships ........................................................................ 11
Using Relationships .................................................................... 12 Queries in Relationships ..................................................................... 12 Forms & Subform Using Relationships ................................................... 14 Reports Using Relationships ................................................................ 16
Importing, Exporting and Linking Data ............................................ 20 Importing data .................................................................................. 20
Importing from a text file ..................................................................... 20 Importing from an Excel spreadsheet ..................................................... 22
Exporting Data .................................................................................. 24 Exporting data to a text file .................................................................. 24 Exporting data as an Excel spreadsheet file ............................................. 26 Linking external data to a database ........................................................ 27 Linking to an Excel worksheet .............................................................. 29
Compact and Repair .................................................................... 31 APPENDIX ................................................................................. 32 Access Switchboards .................................................................. 32
What is a switchboard? ...................................................................... 33 Using a Switchboard ......................................................................... 33 Adding items to an Existing Switchboard ................................................. 34 Editing a Switchboard ........................................................................ 35 Deleting items within a Switchboard ....................................................... 35 Making a Switchboard the default Switchboard .......................................... 36 Displaying Switchboards automatically when opening a database ................... 36 Deleting a switchboard ....................................................................... 37
-
Dallas County Community College District
LeCroy Center Page 4 of 38
Primary Keys
Defining a Primary Key
A Primary Key is used as a unique identifier for each record in a database table and is essential when working with relational tables.
A Primary Key cannot have duplicate entries and must be set on a field generating a unique identifier. When creating a new table Access automatically adds the ID field with an AutoNumber data type. By default the ID field is also the Primary Key.
To set the primary key, right-click on the field (in Design View) and click on Primary Key in the pop-up menu.
Other fields suitable to be used as a Primary Key are: passport, social security and drivers license numbers, military identification, tax, workplace or personal identification numbers, unique to each individual.
NOTE: A primary key field can never be empty.
Access also uses primary keys to index tables (discussed in a later section).
The Primary Key symbol identifies the field being used as the primary key.
NOTE: The Primary Key button is also shown in the Tools group on the ribbon.
NOTE: A name field is not a suitable data type for a primary key because it is not usually unique. When working with related tables, the Primary Key field in one table is
generally the (foreign key) field used to create the relationship with another table. [A foreign key, simply stated, is another table's primary key.]
NOTE: Depending upon the data type, more than one field can be highlighted [hold the CTRL key to select more than one field] and set as a primary key, although only one displays the Primary Key symbol.
-
Access 2010 Advanced
Page 5 of 38 Software Training and Support
Relationships
Table relationships
Good database design suggests data is organized across multiple tables, otherwise it might result in vast amounts of duplicated data and become unmanageable.
Relationships are used to create a link between two or more tables within a database. When a link is established and with the use of other objects within the database, data can be entered into or viewed from one or more tables at the same time, without the need to close one table and open another.
The most common relationships between tables are: One-Many Many-Many One-One
One-to-many Relationship
In a one-to-many relationship, a database would have two tables, one with students and one with class schedules. Each student could be registered for multiple classes.
Many-to-many relationship
Consider a Classes database that includes a Students table and a Class Schedule table. A student can register for multiple classes. It follows that for any class there would be multiple students registered.
A many-to-many relationship, is best achieved by creating two one-to-many relationships, using a third table, often referred to as a Junction. The Primary key from both the Students and Class Schedule tables are added to the third table, Registrations (for example). Thereby effectively creating two one-to-many relationships.
One-to-one relationships
In a one-to-one relationship, each record in the first table can have only one matching record in the second table, and each record in the second table can have only one matching record in the first table. This type of relationship is not common because, most often, the information related in this way is stored in the same table.
NOTE: Both tables must share a common field but not necessarily a Primary key field.
Creating relationships between tables
Before a relationship can be created, a database must contain two or more tables upon which a relationship can be formed.
Start Access and open a database called Advanced2011 from your Access 2007 data files folder. You will notice there are several tables in the navigation pane.
-
Dallas County Community College District
LeCroy Center Page 6 of 38
Double click on the Students table to open it. Take a moment to look at the fields in the table. The Student ID is the Primary Key.
Close the Students table and open the Current Class Schedule 09-10. The
Class Number is the Primary Key.
Close the Class Schedule table. Open the Registrations 09-10 table. You see three fields (figure on right): Registration # (AutoNumber and the Primary Key field); Class ID is the same content as the Class Number field in the Class Schedule; and Student ID which is the Students tables Primary Key.
To create a relationship
between tables, the tables must be closed. Click on the Close button to close each of the three tables.
Click the Database Tools tab, click the Relationships button.
Click the Show Table button in the Relationships group.
The Show Table dialog box should open. You should see the Show Table dialog box. Select three tables: Click Class
Schedule 09-10 then click Add. Click Registrations 09-10 then
click Add. Click Students, click Add. Then click Close (to close the
Show Tables box).
-
Access 2010 Advanced
Page 7 of 38 Software Training and Support
NOTE: You can also double click on a table name to place it in the Relationship window.
The three tables should be in the Relationships window. (see the figure
above) To create a one-to-many relationship between Class Schedule 09-10 and
Registrations 09-10, click the Class Number field in the Class Schedule 09-10 and drag to the ClassID field in the Registrations 09-10 table.
When you release the
mouse button on ClassID the Edit Relationships dialog box will be displayed (see figure on the left).
On the Edit
Relationships dialog box, IF the field is incorrect, click the drop-down arrow and select the correct field name.
-
Dallas County Community College District
LeCroy Center Page 8 of 38
Click Create.
Click StudentID in the Registrations 09-10 table, drag it to the StudentID field in the Students table.
Click Create. The relationships should display (see figure above).
Edit a Relationship To display existing relationships, the database must be open Click the Database Tools tab
.
Click the Relationships button in the Relationships group. To edit an existing
relationship, you must re-display the Edit Relationships dialog box.
To do this, double click the line (1) that represents the relationship between two tables.
Or click the Edit Relationships button in the Tools group of the Relationship Tools Design tab.
Make sure that the correct tables (or queries) are displayed, if they are not,
click the (2) drop down arrows to select the correct tables or fields. You can change the Join Type and/or the Referential Integrity as well as
change the actual relationship between the fields. Make the changes to the relationship as needed. Click OK when done.
NOTE: You can delete relationships by either selecting the line connecting the
tables and pressing delete or by clicking Clear Layout in the Tools group of the Relationship Tools Design tab.
-
Access 2010 Advanced
Page 9 of 38 Software Training and Support
To close the Relationship window, click the Close button in the Relationships group on the Relationship Tools Design tab.
Join Type Open the Relationship window again: the database should be open, click the
Database Tools tab, click the Relationship button in the Relationships group.
To set the Join Type, click the Join Type button on the Edit Relationships dialog box.
There are three choices on the Join Properties dialog box. 1) Only include rows where the joined fields from both tables are equal (match). 2) Include ALL records from Table and only those records from Related Table
where the joined fields are equal (match). 3) Include ALL records
from Related Table and only those records from Table where the joined fields are equal (match).
Select one of the choices and click OK once to get out of the Join Properties.
Click Cancel to not select a Join Type, close the Edit Relationships dialog box.
Referential integrity Good database design suggests dividing information into many subject-based
tables to minimize data redundancy. Relationships are then used to bring the data together by placing common fields into related tables.
To bring data together, Access uses the value in the "many" table to look up the corresponding value in the "one" table.
-
Dallas County Community College District
LeCroy Center Page 10 of 38
Suppose you have a one-to-many relationship between Registrations and Classes. If you decide to delete some of the classes. Student registrations in those classes will become "orphans" when you delete the classes.
Referential integrity is designed to prevent this situation from occurring and keep references in sync so that this kind of situation doesnt occur.
Referential integrity by default is not enabled and therefore has to be enabled
either during the creation of relationships or when editing relationships. enabled, Access will reject any operation that violates referential integrity for that particular relationship.
When
Access rejects updates that change the target of a reference or deletions that remove the target of a reference. In other words, if you attempt to delete an individual class from the Class table that has been referenced in the Registrations table, Access will prevent this from happening.
To enable Referential Integrity, double click on the line between the two
tables to open the Edit Relationships options box again. Check the box in front of Enforce Referential Integrity.
Click OK to close the dialog box.
NOTE: In a One-To-Many relationship, with Enforce Referential Integrity enabled, the line changes to display the digit 1 at one end and the (infinity symbol) representing many, at the other. (see the graphic on previous page) This graphically displays which table is the One and which is the Many in a One-To-Many relationship.
Cascade options There may be occasions when it is necessary to make changes to the Primary Key used in a Relationship. There are two options available in Access which when enabled, allow updates to fields and deletion of records (row) while maintaining data integrity.
-
Access 2010 Advanced
Page 11 of 38 Software Training and Support
You can enable cascading updates only between tables with a one-to-many relationship. You can enable cascading updates only for Primary Key fields set to the Text or Number data types. You cannot use cascading updates for fields set to the AutoNumber data type.
Cascade update related fields
When updating fields in related tables, with this option enabled, Access automatically updates all affected records as part of a single operation and ensures that the updates are completed, without inconsistencies.
Cascade delete related records Equally, you may also have a valid reason for deleting a record in one table and related records in the related table, for example, a record from the Class Schedule table and all related registrations for that Class in the Registrations table. Again, when enabled, Access will automatically delete all related references, maintaining data integrity.
NOTE: Both cascade options are designed for maintenance purposes and
Enabling cascade options
should therefore only be enabled during system maintenance.
To enable Referential Integrity, double click the line between the two tables to open the Edit Relationships options box again.
Click and check the required Cascade option check box.
Click on the OK button to update the changes.
Deleting relationships Once relationships have been established, Access behaves differently and you may find yourself unable to edit tables as you have done in the past, even when referential integrity is disabled. This is because having established a relationship, attempting to delete fields in a related table or editing / changing certain field properties, etc. can have an unintended effect on other related tables, therefore Access prevents the action. NOTE: Make sure your table design and layout works, create and test your tables before you consider establishing relationships. Changes to the design,
improvements and modification over time may also require removal or changes to relationships between tables.
To delete a relationship, click once on the line between the two tables. The line appears thicker.
Right click on the Relationship line to display the shortcut menu.
-
Dallas County Community College District
LeCroy Center Page 12 of 38
Select Delete to delete the relationship.
You will be prompted to confirm the deletion.
Click the Yes button to confirm. The relationship line between the two tables is removed and the tables are no longer related.
Once the relationship is removed the tables are still intact.
Using Relationships Start Access (if you havent already) and open a database called
Advanced2011 from your Access data files folder (unless it is open). Click the Database Tools tab, and then click the Relationships button. Add three tables to the Relationship window: Class Schedule 2009-10,
Registrations 09-10, and Students. To create a one-to-many relationship between Class Schedule 2009-10 and
Registrations 09-10, click the Class Number field in the Class Schedule 2009-10 and drag to the ClassID in the Registrations 09-10 table.
Click StudentID in the Students table, drag to the StudentID field in the Registrations 09-10 table.
To close and Save the Relationship, click the Close button in the Relationships group.
Respond to the Save changes
question by clicking Yes (of the three choices: Yes No Cancel)
Queries in Relationships Click the Create tab, select Query Design. Add the three tables to the query design window: Class Schedule 09-10,
Registrations 09-10, and Students. The Relationships should be visible when the three tables are added. Add these fields to the query grid in this order: Class Schedule 09-10:
Class Number, Course Name, Date, Day, Time; Registrations 09-10: Student ID; and Students: Lastname, Firstname.
-
Access 2010 Advanced
Page 13 of 38 Software Training and Support
Sort the following fields by Ascending: Class Number, Lastname, and Firstname. Save the Query as Class Registrations
Click the Datasheet View button to see the information. Since we told it to use the three related tables, it displayed them with their relationship lines. The Datasheet View below shows that the Class Number was sorted first, then the Last Name was sorted and last the First Name was sorted. So all the people signed up for the same Class Number are listed in alphabetical order.
Save the query again.
You could put in criteria to display specific class registrations or all the registrations for a specific person.
Click the Design View button to put in criteria. In the Course Name Criteria, type *excel* In the Date Criteria, type >8/31/2009
Click Datasheet View to view the records matching the criteria. The records that match the criteria have Excel in the Course Name and the
Dates are after August 2009. Save this query with the name: Excel Classes Sep2009-Mar2010 Create another query with student information first then class information, using
these fields Student ID, Lastname, Firstname, ClassID, Course Name, Date, Day, and Time.
Sort by Student ID. Name this query: Student Registrations
Open the Class Registrations query. [This query will be used in the subform exercise.] Add fields as needed so that you have these fields in this order: Class Number, Course Name, Date, Day, Time, Building, Instructor, StudentID (from Registrations 09-10), FirstName, and LastName.
Save the query with the additional fields.
-
Dallas County Community College District
LeCroy Center Page 14 of 38
Forms & Subform Using Relationships A subform is a form that displays within another form. There needs to be a
relationship between the tables in order to display a subform in a form. Open the query Class Registrations. Be sure that there is no sorting or
criteria in the query grid (in Design View). To create a new Form with
Subform, while in Design View, click the Create tab, then click Form Wizard.
It should be displaying the Query: Class Registrations; in order to put all the fields that are in the Query into the Form, click the double arrow button >> to put all the fields into the Selected Fields list.
Click 1) Next.
The second screen comes up.
The fields from the first table should be at the top, the other fields (in this case from the Registrations and Students
tables) are showing in a separate box below the first fields.
Form with Subform(s) is already selected.
Click the 2) Next button.
Select the Tabular layout from two very similar choices: Tabular or Datasheet. Click the 3) Next button.
-
Access 2010 Advanced
Page 15 of 38 Software Training and Support
Name the 4) form: Class Registrations
Name the 4) subform:
Students Subform
Click the Finish button.
Scroll through and look at the forms and subforms.
Scroll through the classes.
Display the first class record with no students registered (record 4 has no students).
Register a student by typing their ID number in the Student ID field.
Click in the first Student ID field in the subform (it should be blank).
Type 26 in the
Student ID field. Press Tab after typing
and the students name should fill in. (This happens because there is a relationship between the tables.)
Register three more
students in the class by typing these Student IDs on separate lines: 19, 30, and 20. There should be four people registered for the previously empty class.
Close the form. Open the table Registrations. Display the last four records. The last four
registrations should be for students 26, 19, 30, and 20 (the ones you added). The registrations were created because of the relationships that were established.
Close the form and any open queries.
-
Dallas County Community College District
LeCroy Center Page 16 of 38
Reports Using Relationships
The database, Advanced2011 should still be open. Click the Create tab, select
Query Design. Add the three tables: Class Schedule 2009-10, Registrations 09-10, and Students to the grid. The relationship lines should be visible. Click Close on the Show Table window.
Save the Query as Class Roster. [This query will be used in the report exercise.]
Add these fields to the grid: Class Number, Course Name, Date, Day, Time,
Building, StudentID, LastName, and FirstName. Select Sort: Ascending for these three fields: Class Number, LastName,
FirstName. [The LastName column should be before the FirstName column in the grid. If
it isnt, then move the LastName column in front of the FirstName column.]
NOTE: The Building field, has the Caption Campus.
Save Class Roster query again.
Click Datasheet View to see the
query results. Close the Query. Select the Class Roster query
(without opening it). Click 1) create Report Wizard. Click 2) >> to put all the
Available Fields in the Selected Fields box.
Click the 3) Next button.
-
Access 2010 Advanced
Page 17 of 38 Software Training and Support
How do you want to view your data? by Class Schedule 2009-10 is already selected.
Click the 4) Next button.
Do you want to add any grouping levels? Click Class Number then click the > button to group by Class Number.
(Class Number should then display at the top right as in the figure.)
Click the 5) Next button.
Select the 6) LastName and
FirstName fields to sort by Ascending.
Click the 7) Next button.
-
Dallas County Community College District
LeCroy Center Page 18 of 38
Select 8) Block Layout and Portrait Orientation.
Adjust the field width so all fields fit on a page. should be selected
, leave it selected.
Click the 9) Next button.
For the 10) title of the report type: Class Roster
Preview the report. is selected, leave it selected.
Click 11) the Finish button.
The Class Roster report is displayed in Print Preview View. There are several things that need to be changed in the report: any column
that has ##### in it needs to be widened, some of the field captions may need to be shorter, and each class should be on a separate page.
Save the report.
-
Access 2010 Advanced
Page 19 of 38 Software Training and Support
If there is time in class, your instructor may want to work on editing this report. The figure below is what the report could Open the report in Design View. The default page margins are .25, you
might want to use Page Setup to change the margins before any other changes.
look like after editing.
The figure above, has been edited to show one class per page, with the class
name at the top of the page. The Detail has been moved to the Page Header except for the student information.
The Properties of each group have been changed to have a Page Break before each Section.
The font size has been changed, the fields are displaying in the selected manner.
Since we were using a relationship, you can print a roster for each class. Once you have made any edits, look at the Print Preview. Close the
Advanced2011 database when finished.
-
Dallas County Community College District
LeCroy Center Page 20 of 38
Importing, Exporting and Linking Data
Importing data
Importing from a text file
Data can be imported from the delimited text files where each field is separated by a character (e.g. comma, or tab), or fixed-width text files where each field has a fixed width. This source file must have the same type of data in each field and the same fields in every row.
Open your sample Database1 file.
Click the External Data tab and within the Import group click the Text File button.
This will open the Get External Data - Text File dialog box.
Click the Browse button.
Change to the folder containing your sample files.
Select your text file, in this case a file called Staff.csv
Click the OK button. Within the dialog box displayed select whether to import data into a new table, append to an existing table, or link the data source.
In this example select the first option to import data into a new table in the current database.
Click the OK button. In the second dialog box you can select the Delimited file option or fixed width file option. In this case the select Delimited file option.
Click the Next button.
-
Access 2010 Advanced
Page 21 of 38 Software Training and Support
You will see the dialog
box on the right. Click Comma.
Select First Row
Contains Field Names. Click Next.
If you want to skip any fields, click in the field and check Do not import field (skip) for each
field to skip.
Click Next. Click No Primary Key.
Click Next.
-
Dallas County Community College District
LeCroy Center Page 22 of 38
Either type a name for
the new table or use Staff.
Click the Finish button. Click Close to close the
import screen.
You will see the new table called Staff displayed at the bottom of the All Tables list in the Navigation Pane.
If you open the
table, it will look like the figure on the right.
Close the table before continuing.
Importing from an Excel spreadsheet Click the External Data tab and click the
Excel button in the Import & Link group. This will open the
Get External Data Excel Spreadsheet dialog box, as shown on the right.
Click the Browse button, locate the folder containing the Excel file to be imported. Select the filename Contacts.xls and click Open.
Select Import the source data into a new table in the current database.
Click the OK button to start the import.
-
Access 2010 Advanced
Page 23 of 38 Software Training and Support
Select First Row Contains Column Headings.
Click the Next button.
If you wish to skip a field(s), select the field and check the box in front of: Do not import field (Skip). Do that for each
Click the Next button.
field to be skipped.
Select No Primary
Key. Click Next.
-
Dallas County Community College District
LeCroy Center Page 24 of 38
Type the name Contacts.
Click the Finish button. Click the Close button without
making any changes.
You will see your
Contacts table displayed in the All Tables list.
Open up your
Contacts table and it will look like the figure on the right.
Close the table before continuing.
Close the database.
Open the Adavanced2011 database.
Exporting Data
Exporting data to a text file
Select the 1) Students table from the list.
Click the 2) External Data tab
In the Export group click the 3) Text File button.
-
Access 2010 Advanced
Page 25 of 38 Software Training and Support
You will see the dialog box on the right displayed.
Click the Browse button.
Select the folder destination for your exported file.
The file will be called Students.txt unless you change it to a
different name.
Click the OK button.
Delimited should already be selected if not, select it.
Click the Next
button.
You will see the dialog box on the right.
Select Comma if it is
not already selected. Select Include Field
Names on First Row if you want it.
Click the Next
button.
-
Dallas County Community College District
LeCroy Center Page 26 of 38
You will see the screen on the right. It displays the filename and folder it will export to.
Click the Finish
button.
Click the Close button. Your file will be created and saved in the folder you specified. If you have time you may wish to open this file with Notepad. Please close any open tables before continuing.
Exporting data as an Excel spreadsheet file Click the Class Schedule 2009-10 table to select it from the All Tables list.
Click the 1) External Data tab
Click the 2) Excel button, in the
Export group. You will see the
dialog box displayed on the right.
Click the Browse button.
Select the folder destination for your exported file.
Unless you change the filename, it will be saved as Class Schedule 09-10.xlsx
You can change the File format with the drop down list on the left.
Click the OK button.
-
Access 2010 Advanced
Page 27 of 38 Software Training and Support
Click the Close button.
If there is time, open Excel and open the Excel file (Class Schedule 2009-10.xlsx) that was just created.
Close Excel (if you opened it).
Linking external data to a database Linking to external data sources
is one of the more powerful features in Microsoft Access. Access supports linking to data in several different formats.
Click the External Data tab click
the Text File button in the Import group. This will open the Get
External Data - Text File dialog box.
Click the Browse button.
Select the Text file, in this case a file called Staff.csv Click Open.
Select the third option to Link to the data source by creating a linked table.
NOTE: You cannot change or delete data that is linked to a text file. You can add new records.
Click the OK button and you will see the figure at the top of the next page
-
Dallas County Community College District
LeCroy Center Page 28 of 38
In this dialog box you can select either the Delimited option or Fixed Width option, in this case select Delimited.
Click the Next button.
You will see the dialog
box shown on the right.
Select First Row Contains Field Names. As the default, Comma is already selected.
Click the Next button.
If you need to change the
Data Type of a field or if you need to select Do not import field (Skip) you will need to do so on this screen for each field
that needs to be changed.
Click the Next button.
-
Access 2010 Advanced
Page 29 of 38 Software Training and Support
You will see the dialog box shown on the right. Enter the Linked Table Name: Our Staff.
Click the Finish
button.
You will see this message displayed:
Click the OK button.
In your database, you will see the linked table displayed along with a small arrow, as shown on the right.
Linking to an Excel worksheet Click the External Data tab.
Click the Excel button in the Import
group.
This will open the Get External Data - Excel Spreadsheet dialog box (shown at the top of the next page).
-
Dallas County Community College District
LeCroy Center Page 30 of 38
Click the Browse button.
Select the folder containing your files.
Select the Excel file, called
Contacts.xls. Select the third option to Link
to the data source by creating a linked table.
Click the OK button.
You will see the dialog box shown
on the right. Select the First Row Contains
Column Headings.
Click the Next button. Enter the name Our Contacts
for the Linked Table Name.
Click the Finish button.
You will see the message displayed: Finished linking table Our Contacts to the file \Contacts.xls
Click the OK button.
You will see the linked tabled
displayed along with a small arrow, as shown on the right.
Close the database.
-
Access 2010 Advanced
Page 31 of 38 Software Training and Support
Compact and Repair As databases become bigger the size can create performance problems or the data can become corrupt or damaged. Access has a way to maintain the database so it performs well called Compact and Repair Database.
Copy the database Orders-large.accdb and name the copy Orders-
before.accdb
Click the File tab. Open the database 1) called Orders-large.accdb
Click 2) Info if it is not already selected.
Click 3) Compact and Repair Database.
The database should be a little less than 300 KB smaller.
Close the database. Compare the before and after sizes.
Close the database and close Access.
-
Dallas County Community College District
LeCroy Center Page 32 of 38
APPENDIX
Access Switchboards Microsoft is evidently beginning to phase out the Switchboard command beginning with Access 2010. It is not on any of the ribbon tabs. Searching in Access 2010 Help for switchboard or switchboard manager does not come up with anything. You can add Switchboard Manager to your Quick Access Toolbar. (It is possible the next version of Office will not have it at all.) Because it seems that Microsoft is phasing it out, we will only
cover in class how to edit and use an existing switchboard.
NOTE: To add the Switchboard Manager to your Quick Access Toolbar follow these steps: Click the File tab
Click Options
(see figure right)
Click Quick Access Toolbar in the menu on the left. (see figure on far right)
On the Quick Access Toolbar screen under Choose commands from: select All Commands.
Scroll down in All Commands to S (commands are listed alphabetically)
Click Switchboard Manager Click Add to add it to the Quick
Access Toolbar.
The Switchboard Manager button has been added to the Quick Access Toolbar.
-
Access 2010 Advanced
Page 33 of 38 Software Training and Support
What is a switchboard?
Switchboards are the screens used to navigate around a database and perform tasks, such as running reports.
A switchboard is made of buttons that you can click on. You can program these buttons to open forms, reports, queries, etc.
This form is basically a customized menu that contains user-defined commands; using either buttons, labels, images or hyperlinks, that invoke actions that will automatically carry out tasks for you such as opening other forms, running queries or printing reports.
You can create a switchboard form using various manual methods or by using the Microsoft Access Switchboard Manager. The form can use either VBA procedures, stored in modules behind the form or hyperlinks that either doesnt contain any associated code, or that can invoke functions from standalone code modules.
Using a switchboard form in your Microsoft Access database application allows you to tie together all of the other objects that you have created for your database users in a single form, and removes the need for the users to have to openly navigate from within the database window. You can also use this as the interface for your application, removing the chances of your users tampering with any of the objects that lie behind the scene of your application.
Using buttons on your switchboard form can also replace the many possible steps that it would take the user to navigate around the objects in the database. To simply open a form in the database, the user may need to switch to the database window, choose the Forms tab and open the form from there. Using a command on the switchboard interface, the user now only has to click one button to carry out the same action.
The Switchboard Manager can be used to create, delete, add, or edit switchboards.
Before starting the exercise, please add the Switchboard Manager button to the Quick Access Toolbar, if it is not already there.
Using a Switchboard Open MyDatabase. (If you had another database open, close it first.)
Switchboard Items should be in the Navigation Pane on the left side of the
screen.
Display the Switchboard Items if they are not already displayed.
Double click on the Switchboard Form. Your screen should look similar to the one in the figure at the top of the next
page.
-
Dallas County Community College District
LeCroy Center Page 34 of 38
Adding items to an Existing Switchboard
Click the Switchboard Manager button in the Quick Access Toolbar. It will open the Switchboard Manager dialog box.
Click the Edit button.
It will open the Edit Switchboard Page dialog box.
Click the New button which will open the Edit Switchboard Item dialog box.
In the Text field enter a title for the item (this will display in the menu). Create a button to close the database, therefore enter the text: Exit Database.
In the Command field drop down list select Exit Application.
Click OK. This will add an item: Exit Database to the switchboard items.
-
Access 2010 Advanced
Page 35 of 38 Software Training and Support
Editing a Switchboard
Click the Switchboard Manager button in the Quick Access Toolbar.
It will open the Switchboard Manager dialog box.
Select a switchboard item by clicking on it then click the Edit button.
This will open the Edit Switchboard Page dialog box.
NOTE: As you can see you could edit the switchboard by adding, deleting, moving items up or down etc.
In this example, select Student Report and click the Move Up button.
Click the Close button to close the Edit Switchboard Page dialog box.
Click the Close button in the Switchboard Manager dialog box to close it. Display your switchboard and the item you selected should have moved up in the menu.
Deleting items within a Switchboard
Click the Switchboard Manager button. It will open the Switchboard Manager dialog box.
Select a switchboard or a switchboard page to delete.
Click the Delete button.
A warning dialog box will display. Click Yes if you are sure you want to delete it.
Click the Close button to close the Edit Switchboard Page dialog box.
Click the Close button in the Switchboard Manager dialog box to close it.
-
Dallas County Community College District
LeCroy Center Page 36 of 38
Making a Switchboard the default Switchboard
If you have more than one switchboard, then you can make one of them the default switchboard.
In the Switchboard Manager, on the Switchboard Pages list you can see all the existing switchboards.
Click a switchboard then click Make Default button.
Click the Close button in the Switchboard Manager dialog box to close it.
The selected switchboard is now the default Switchboard. NOTE: It will make the Switchboard the default switchboard. In this example we only have one Switchboard, but this illustrates the principle.
Displaying Switchboards automatically when opening a database
The switchboard is a navigational page. It provides links to the forms and reports in your database, you can display the switchboard as soon as you open your database.
Click the File tab, click Options (bottom left). This will open the 1) Access Options dialog box.
Click 2) Current Database in
-
Access 2010 Advanced
Page 37 of 38 Software Training and Support
the left panel.
In the 3) Display Form: drop down list select 4) Switchboard.
Click the 5) OK button at the bottom. A message box will appear to inform you that your changes will take effect when you close and re-open the database.
Click OK.
Close the database.
Open Access 2010 and reopen the MyDatabase sample file. You will see that the Switchboard is automatically displayed when the database opens.
Deleting a switchboard Click the Database Tools tab,
and within the Database Tools group click the Switchboard Manager button. It will open the Switchboard Manager dialog box.
In the Switchboard Pages list you can see all the existing switchboards. Select a switchboard by clicking it, i.e. select My Switchboard.
Click the Delete button. A message box will appear. Click Yes to confirm the deletion.
It will delete the selected Switchboard. Click the Close button in the Switchboard Manager dialog box to close it.
-
Class registration and schedule: http://helpdesk.dcccd.edu
or
www.dcccd.edu Employees > Training and Development > Software Training and Support
Dallas TeleCollege at the R. Jan LeCroy Center for Educational Telecommunications
District Software Training & Support 9596 Walnut St. Dallas, TX 75243
STAFF Helpdesk Phone: 972-669-6477
STUDENT Helpdesk Phone: 972-669-6402 E-mail: [email protected]
Web Site: http://helpdesk.dcccd.edu Training Web Site: http://employeetraining.dcccd.edu
Primary KeysDefining a Primary Key
RelationshipsTable relationshipsOne-to-many RelationshipMany-to-many relationshipOne-to-one relationshipsCreating relationships between tablesEdit a RelationshipJoin TypeReferential integrityCascade optionsDeleting relationships
Using RelationshipsQueries in RelationshipsForms & Subform Using RelationshipsReports Using Relationships
Importing, Exporting and Linking DataImporting dataImporting from a text fileImporting from an Excel spreadsheet
Exporting DataExporting data to a text fileExporting data as an Excel spreadsheet fileLinking external data to a databaseLinking to an Excel worksheet
Compact and RepairAPPENDIXAccess SwitchboardsWhat is a switchboard?Using a SwitchboardAdding items to an Existing SwitchboardEditing a SwitchboardDeleting items within a SwitchboardMaking a Switchboard the default SwitchboardDisplaying Switchboards automatically when opening a databaseDeleting a switchboard