Documente Academic
Documente Profesional
Documente Cultură
http://www.functionx.com/access2007/Lesson02.htm
In the previous lesson, we saw that you could create a database using one of the available templates. This approach provides you with readily made objects you can directly start using. Another technique consists of creating an empty database that has no built-in object. Starting a database from scratch allows you to create and add its different objects when necessary.
The main advantage of this approach is that you will exercise as much control as possible on your database because you will be creating all of your objects. The disadvantage is that you will miss that primary layout that the templates offer. Creating a database from scratch simply means starting from a blank database and adding the different components. Of course, after learning how to perform some changes, you will be able to modify some aspects of a database, whether created from a template or started from scratch. To create a database from scratch, if you are just launching Microsoft Access, in the left section, you can click Featuring. Then, in the main section in the middle, click Blank Database, give a name in the File Name text box, and click Create.
1 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
Introduction to Tables
Imagine you create a list of people. The list can be started with names as follows: Bill, James, Hermine, and Khan. This type of list is considered one-dimensional because all of its items fit in one category. In order to create a more detailed list, you may want to include these peoples email addresses and probably other related information. If you include these additional pieces of information in the same category, the list may become confusing. To arrange the list, you would divide it in categories. Here is an example: Name Bill James Hermine Khan @Khan.com Email Address bill@yahoo.com jamesemail.com (102)399-2893 (101) 447-8384 Cousin Phone Number Relationship Friend
Custom FIB Apertures Low Cost Custom Aperture Strips with 3 Day Delivery
www.Oregon-Physics.com
This type of display allows you to refer to a piece of information by its category. This is the basis of a table. A table is a two-dimensional list of items so that the items are arranged by categories. A complete or incomplete series of items that represent each category is called a record. Therefore, a table can be represented as follows:
#1 Database Software Develop with Unlimited Power Download the Free Trial here
www.4d.com/trial
OOP with C++ Training OOP Using C++ Training Courses Quickly Learn C++ Programming
www.e-learningcenter.com
Excel for In database development, a category is represented as a column. Sometimes it is also called a Procurement field. A record is represented as a row. Learn how use MS Excel functions, like Database Object and Fields pivot tables, with this class! A field is an object used to host, hold, or store a piece of information of a database. Before www.NextLevelPurchasing.c such an object can perform its function, it must first be created. In the strict sense, the most important or the most regularly used fields of a database are created on a table, but tables may not be the friendliest windows to present to a user for data entry. For this reason, fields can and should also be created on other windows.
The process of making a field available depends on the type of object it will reside on and probably how the field will be used. This leads to two categories of fields: those that can receive or store information and those that can only present or display it. All fields of a table, especially in Microsoft Access, are created to store data. On the other hand, fields on almost all of the other objects (queries, forms, reports) can be made of combinations of already existing fields of a table, or they can be created independently of any existing or non-existing data.
Table Layout
The Table's Tab
A table is presented as a rectangular window represented in the middle of the screen with a tab. As an option, you can remove the tabs and let the tables display without them. To do this, you can click the Office Button and click Access Options. In the left frame, click Current Database and, in the right frame, in the Document Window Options section, click the Tabbed Documents radio button and remove the check mark on the Display Document Tabs check box:
2 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
After making the selection, you can click OK. You will be asked to close and reopen the database:
Which you should do. On the left side of its top section, a table presents an icon . The table icon provides a menu you can access when you right-click. The menu allows you to save or change the view of the table. When a table displays with a tab, the extreme right section of the tab(s) shows a close button you can click to close the table.
3 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
A Table as a Datasheet
Although a table is primarily recognized as an arranged list of columns and rows, each column and each row intersect to create a rectangular box called a cell:
The cell is actually the object that holds data of a table. A cell holds only one piece of information. The database developer decides what type of information would go into a cell but the user types that information. Based on its arrangement of cells, a table is said to display in a datasheet layout or simply a datasheet (because its view is made of cells).
The presence or absence of one or both scroll bars is automatically managed by the operating system and you should not be concerned with the management of the scroll bars. At the same time, if your users need to use a table, they know how to use a scroll bar.
4 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
First Record Previous Record Current Record Next Record Last Record
Allows moving to the first record of the table Allows you to move one record back (if there is one) from the current record Displays the number representing the current record out of the total number of records Allows moving you one record ahead Allows moving you to the last record of the table
From the menu that appears, you can click one. This would open a new table for you. You can then save it.
5 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
If a table has not been saved before, you will be asked to provide a name for the table. A table can have almost any name: Employees, 2&&4DG, Pestes, verTT#@tg, etc. Because you and your users should be able to easily identify a table, there are suggestions you should follow when naming it: The name of a table should reflect the kind of data it is holding You can name a table with a few words, with spaces You can use a prefix that identifies the table as such, a table. The name of a table would be preceded with tbl. If the name includes one word, such as Musicians, you can give the table a name like tblMusicians, another name would be tblStudents If the name of the table reflects a combination of words, such as Bank Accounts or Students Academic Numbers, you should start each new word with an uppercase. Here are examples: tblBankAccounts, tblStudentAcademicNumbers, tblMemberRegistrations. In our lessons, we will not use the convention of prefixing the name of a database object with three letters. For example, the names of tables will not start with tbl. We came to this decision because most other database environments, including Microsoft SQL Server, do not suggest this rule. Although the lack of this rule may create some confusion, because you will end up having a table and a form with the same name, we will strive to explicitly state what object type we are referring to. For example, we will avoid writing, "Open Employees" or "Open the Employees object". Instead, we will usually state, "Open the Employees table".
Table Management
The Tables in the Navigation Pane
Because the table is the primary object of a database, when you create a table and save it by giving it a name, Microsoft Access creates a section in the Navigation Pane and name that section after the table. In the same way, you can have as many sections as the number of tables on the database. Here is an example:
As we will see in the next lesson, some objects created that are based on the table would be listed under the table name in its category. Here is an example of two objects added to the section of a table named Customers:
Each section is expandable and collapsible. To expand a section, click the name of its section. to collapse a section, click the blue header of its section.
6 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
Once a table has been created and saved, it is represented in the Navigation Pane with an icon and a name.
Opening a Table
The most regular operations you will perform on a table require that you open it first. To open a table, first locate it in the Navigation Pane then: You can double-click the table You can right-click the table and click Open Any of these actions causes the table to display in Datasheet View in the central area of the screen. In the same way, you can open as many tables as necessary.
Closing a Table
After using a table, you can close it. Before closing a table, first select its tab. Then, to close a table: You can click the close button You can press Ctrl + Shift + F4 on the right side of the tabs
Selecting a Table
In order to use a table, some operations require that you (or rather the user) first select(s) it: To select a table in the Navigation Pane, simply click it If you had opened many tables and they are displaying in the main area of the screen, to select one, click its tab or its title bar If you have many tables displaying in the main area of the screen, you can press Ctrl + F6 continuously to switch from one table to the next until the desired one displays
Renaming a Table
We saw that, when or after creating a table, you must save it to make it part of your database. When saving it for the first time, you must give it a name. If the name of a table is not appropriate, you can change it. To rename a table, in the Navigation Pane, you can right-click the name of the table and click Rename.
Deleting a Table
If you have a table you don't need anymore, you can remove it from your database. Because you cannot delete a table if it is opened, you must first close it. To remove a table from your database: In the Navigation Pane, right-click the table and click Delete In the Navigation Pane, click the table to select it. Then, on the ribbon, click Home. In the Record section, click Delete In the Navigation Pane, click the table to select it and press Delete In each case, you will receive a warning to confirm what you want to do. It is important to know that if you delete a table, because it is not a file, it does not go into the Recycle Bin: it is lost, including its records. Therefore, before deleting a table, make sure you really want to get rid of it. When in doubt, do not delete it.
7 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
Creating a Column
Although we didn't mention it so far, a table does not exist without a column. Put it another way, a table must have a least one column in order to have meaning. This also means that, in order to create a table, it must actually have at least one column. If you start a table in Datasheet View, Microsoft Access creates and gives it one default column. Once a table displays in Datasheet View, you can start entering data into its cells. If you do this, whenever you enter data under a column, that column receives an incremental name: the first column on the right side of ID would be named Field1, the second would be Field2, and so on. These would be insignificant and can even be confusing. Fortunately, you can give meaningful names to the columns of your table.
Naming a Column
A column can have almost any name: "Book Title", "DG$5@H", "This Is The Book Title", "R8%%DW$4", etc. Some columns will have only tinny data, like a person's age, the number of books in an office, a persons middle initial, etc. It may not be a good idea to give them a name that would take too much space. In the future, when you start programming, it would be easier to handle field names that are composed of only one word, without space. To name a field, first figure out what the data in the category will be made of. If you are planning to enter employees' salaries in a field, you can just call it Salary. If you want to specify employees names by first name, middle name, and last name, you can use such column names and make them distinct. In this case, you could name the first column as first name, the last name would be called last name. Although you can use one word names, some people might be confused. The suggestion is to distinguish wherever a new English (or the language you are using to design your database) name starts in the field name, by using a starting uppercase. Instead of firstname or first name, you can use FirstName or First Name. Instead of fullname or full name, you can use FullName or Full Name. Before changing the name of a column: You can double-click its header You can right-click a column and click Rename Column When any cell under a column has focus, on the ribbon, you can first click Datasheet. Then, in the Fields & Columns section, click Rename Column. Any of these actions would put the name of the column into edit mode. You can then type the new desired name or change the existing name.
6. As the caret in blinking in the next column header, type Order Time and press Enter 7. As the caret in blinking in the next column header, type Container and press Tab
8. Close the table 9. When asked whether you want to save it, click Yes 10. Type Customers Orders as the name of the table 11. Click OK
8 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
By default, the Field Templates window is positioned on the right side of the screen. This is a dockable window: you can move it to the left or place it somewhere else on the screen. The items in the Field Templates window are organized in categories identified with a labeled node, such as Basic Fields, Assets, or Contacts. Each node displays a - button. This - button indicates that the node is expanded. To collapse a node, you can click its - button, which becomes a + button. To expand a node, you can click its + button. Here is an example where the Assets, the Contacts, and the Issues nodes are collapsed while the Events and the Projects nodes are expanded:
To use a field from the Field Templates window: You can double-click the field You can click and drag the field from the Field Templates and drop it on the table to the left of Add New Field:
9 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
Selecting a Column
Some operations will require that you select a column but it depends on the operation. In some cases, when any cell under a column has focus (for example if the caret is blinking in a cell of a column), the column is considered to be selected. Otherwise: To select one column, position the mouse on its name until the cursor points down and then click
10 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
To select columns in a range, click and hold your mouse on one of them, then drag to the left or to the right to cover the other desired column or columns. When all desired columns are highlighted, release the mouse To select a range of columns, click one column that will be at one end, press and hold Shift, then click the column that will be at the other end, and release Shift
If you double-click, the column would be resized to the widest value of the column, provided the widest value is wider than the column header. If the widest value is narrower than the column header, the column width would be widened enough to display the name of the column. You can click the column's right border and drag in the desired direction, left or right until you get the desired width
You can right-click a column's name and click Column Width... This would open the Column Width dialog box where you can type the desired value and click OK
Moving a Column
If you find out that a particular column is misplaced in a table, you can change its position. To move a column in Datasheet View, first select it, click and hold your mouse on it. Then, start dragging left or right in the desired direction. While your mouse is moving, a thick vertical line will guide you. Once the vertical line is positioned to the desired location, release the mouse:
11 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
To move a group of columns, first select them as we reviewed earlier, click and hold the mouse on one of the selected columns, start dragging left or right in the desired direction until the thick vertical guiding line is positioned in the desired location, then release the mouse:
Inserting a Column
Inserting a column consists of adding one between two existing fields. There are various ways you can do this: To insert a column using the ribbon, first click a cell under the column that will succeed it. Then, in the Fields & Columns section of the Datasheet tab, click the Insert button To insert a column from the table, right-click the column that will succeed it and click Insert Column To insert a field from the Field Templates, click and drag it from the Field Templates and drop it to the left of the column that will succeed it
Renaming a Column
12 of 14 31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
We saw various techniques of naming a column. You can use the same approach to change the name of a column. To put the name of a column into edit mode and then change it: You can double-click its name on the header You can right-click the column's name and click Rename Column When any cell under the column has focus, on the ribbon, click Datasheet, in the Fields & Columns section, click the Rename button
To hide one or a group of columns, you can right-click and click Hide Column. You can also right-click any column and click Unhide Column. This would open the Unhide Columns dialog box. Here is an example:
13 of 14
31/08/2012 17:14
http://www.functionx.com/access2007/Lesson02.htm
To reveal a column or a group of columns previously hidden, right-click any column header on the table and click Unhide Column. In the Unhide Columns dialog box, put a check mark on each column you want to show.
Deleting a Column
If you have an undesirable column in a table, you can delete it. It is important to keep in mind that if you delete a column, it also goes with any information under it. To remove a column from a table: You can right-click the column's name and click Delete Column You can select the column (or a group of columns), right-click anywhere in the table and click Delete Column You can select a column (or a group of columns). Then, in the ribbon, click Datasheet. In the Fields & Columns section, click the Delete button Any of these actions would present you a warning to confirm whether you still want to delete the column(s) or you want to change your mind. If you still want to remove the column(s), click Yes.
Lesson Summary
MCAS: Using Microsoft Office Access 2007 Topics
C1 C2 C3 E2 Create databases Create tables Modify tables Navigate among records
Watts A loan
1. Create a blank database and name it Watts A Loan1 2. After the default ID column, create the following additional columns: FirstName, MiddleName, LastName, Address, City, State, ZIPCode, Country, HomePhone, WorkPhone, EmailAddress, and Notes 3. Rename the ID column as CustomerID, 4. Save the table as Customers
Previous
Next
14 of 14
31/08/2012 17:14