Access Lesson 2 Creating a Database
Creating a Database You can use a template that already has objects in it. You can also use a Blank Database template with no objects in it.
Creating and Saving a Table When you create a blank database, Access creates the first table and names it Table1. You can change the name when you save it. The new table name appears on the tab for the table and as an object in the Navigation Pane.
Designing a Table After creating a table, tell Access what fields to include. Access creates one field named ID and sets it as the primary key. primary key--field that contains a unique field value for each record In some tables, this field is called AutoNumber because it automatically adds a unique number.
Designing a Table You can tell that Access created an AutoNumber for the ID field because of the word New in the first record’s field. Good candidates for being a primary key are Employee numbers Social security numbers Student ID numbers The advantage of setting a primary key is that Access will not let you enter duplicate values for this field in different records.
Datasheet—where you enter records directly into the table. 2 views: Datasheet—where you enter records directly into the table. Design—design new tables and modify the design of existing tables Datasheet View Design View
Designing a Table To enter a field name in Datasheet view, double-click the “Add New Field” field selector. After you have created all the fields, you can enter the first record. Access assigns a data type as you enter data (Text, Memo, Number, etc.). You can change the data type-- Table Tools> Datasheet tab>Data Type & Formatting>Data Type arrow
Data Type Description Text Letters and numbers up to 255 characters Memo Letters and numbers up to 65,535 Number Stores numbers Date/Time Date/time Currency Dollar sign and decimal AutoNumber Gives a unique number to each record Yes/No Yes/No, True/False, or On/Off OLE Object Stores graphics, sound and objects Hyperlink Value with a hyperlink Lookup Wizard Lets you lookup a value from a list Attachment Stores graphics, sound and movie files as attachments
Working in Design View Design View--add, delete, and make changes to how fields store data The Field Properties pane appears below. A selected field turns orange. The primary key has a key symbol in it.
Working in Design View Table Tools Design>Tools to: Add and delete fields, insert a field Drag fields in the design grid to a new location Rename a field, and change a field’s data type The Description property in the design grid is optional, and you can use it to describe what to enter in the field. Any changes made in Design view are automatically updated in Datasheet view when you save the table.
Changing Field Properties in Design View field property--describes the field’s contents beyond the basics Indicating number of characters allowed Indicating allowable values Field properties will vary depending on the field’s data type. The Field Size property sets the number of characters you can store in a Text, Number or AutoNumber field.
Changing Field Properties in Design View Use the Format property to specify how you want Access to display numbers, dates, times and text. For example, if you enter the date 10-28-10, Access will display it as October 28, 2010, if the Format property is set that way. Default Value property--enters the same field value in every field Required property--specifies whether you must enter a field value in a record