Learning Resources
Create Open and Save database and table
Creating a database
Use a Database Wizard to create in one operation the required tables, forms, and reports for the type of database you choose — this is the easiest way to start creating your database. The wizard offers limited options to customize the database.
-
Click New
on the toolbar.
- In the New File task pane, under Templates, click On my computer.
- On the Databases tab, click the icon for the kind of database you want to create, and then click OK.
- In the File New Database dialog box, specify a name and location for the database, and then click Create.
- Follow the instructions in the Database Wizard.
Create an empty database without using a Database Wizard -
-
Click New
on the toolbar.
- In the New File task pane, under New, click Blank Database.
- In the File New Database dialog box, specify a name and location for the database, and then click Create.
The Database window appears, and you can create the objects that you want in your database.
Creating a database in Microsoft Access is relatively straightforward.
1.After starting Microsoft Access, a database screen appears. In this case, you can simply select "Blank Database".
If you already have Access open, you can go to the "File" menu and click on "New Database":
2.Choose "Blank Database". (Skip this step if you already chose "Blank Database" at step one). You also have the ability to choose from a template, but we'll just use a blank database here:
3.Choose a location to save the database:
New Database
Once you've completed the above tasks, you should see a blank database. We know this database is blank because it doesn't have any tables. If it did, you would see these tables in the middle pane of the table tab. Now that we have our blank database, we can start adding some tables.
Create Table
Creating a Table by Using the Table Wizard
Microsoft Access has a wizard named the Table Wizard that will create a table for you. This wizard gives you suggestions about what type of table you can create (for example, a Mailing List table, a Students table, a Tasks table, and so on) and gives you many different possible names for fields within these tables. To use the Table Wizard to create a table, follow these steps:- Create a new, blank database.
- In the Database window, click Tables under Objects, and then click New.
- In the New Table dialog box, double-click Table Wizard.
- Follow the directions in the Table Wizard pages.
Creating a Table by Entering Data in a Datasheet
In Microsoft Access, you can also create a table by just entering data into columns (fields) in a datasheet. If you enter data that is consistent in each column (for example, only names in one column, or only numbers in another column), Access will automatically assign a data type to the fields. To create a table by just entering data in a datasheet, follow these steps:- Create a new, blank database.
- In the Database window, click Tables under Objects, and then click New.
- In the New Table dialog box, double-click Datasheet View. A blank datasheet is displayed with default column names Field1, Field2, and so on.
-
Rename each column that you want to use. To do so, double-click the column name, type a name for the column, and then press ENTER.
You can insert additional columns at any time. To do so, click in the column to the right of where you want to insert a new column, and then on the Insert menu, click Column. Rename the column as described earlier. - Enter your data in the datasheet. Enter each kind of data in its own column. For example, if you are entering names, enter the first name in its own column and the last name in a separate column. If you are entering dates, times, or numbers, enter them in a consistent format. If you enter data in a consistent manner, Microsoft Access can create an appropriate data type and display format for the column. For example, for a column in which you enter only names, Access will assign the Text data type; for a column in which you enter only numbers, Access will assign a Number data type. Any columns that you leave empty will be deleted when you save the datasheet.
- When you have added data to all the columns that you want to use, click Save on the File menu.
-
Microsoft Access asks you if you want to create a primary key. If you have not entered data that can be used to uniquely identify each row in your table, such as part numbers or an ID numbers, it is recommended that you click Yes. If you have entered data that can uniquely identify each row, click No, and then specify the field that contains that data as your primary key in Design view after the table has been saved. To define a field as your primary key after the table has been saved, follow these steps:
- Open the table that Access created from the data that you entered in datasheet in Design view.
-
Select the field or fields that you want to define as the primary key.
To select one field, click the row selector for the desired field.
To select multiple fields, hold down the CTRL key, and then click the row selector for each field. -
On the Edit menu, click Primary Key.
If you want the order of the fields in a multiple-field primary key to be different from the order of those fields in the table, click Indexes on the toolbar to display the Indexes window, and then reorder the field names for the index named PrimaryKey.
Creating a Table in Design View
If you want to create the basic table structure yourself and define all the field names and data types, you can create the table in Design view. To do so, follow these steps:- Create a new, blank database.
- In the Database window, click Tables under Objects, and then click New.
- In the New Table dialog box, double-click Design View.
-
In the
: Table dialog box, define each of the fields that you want to include in your table. To do so, follow these steps:
- Click in the Field Name column, and then type a unique name for the field.
- In the Data Type column, accept the default data type of Text that Access assigns or click in the Data Type column, click the arrow, and then select the data type that you want.
- In the Description column, type a description of the information that this field will contain. This description is displayed on the status bar when you are adding data to the field, and it is included in the Object Definition of the table. The description is optional.
-
Once you have added some fields, you may need to insert a field between two other fields. To do so, click in the row below where you want to add the new field, and then on the Insert menu, click Rows. This creates a blank row in which you can add a new field.
To add a field to the end of the table, click in the first blank row.
- After you have added all the fields, define a primary key field before saving your table. A primary key is one or more fields whose value or values uniquely identify each record in a table. To define a primary key, follow these steps:
-
Select the field or fields that you want to define as the primary key.
To select one field, click the row selector for the desired field.
To select multiple fields, hold down the CTRL key, and then click the row selector for each field. - On the Edit menu, click Primary Key.
- If you want the order of the fields in a multiple-field primary key to be different from the order of those fields in the table, click Indexes on the toolbar to display the Indexes dialog box, and then reorder the field names for the index named PrimaryKey.
You do not have to define a primary key, but it is usually a good idea. If you do not define a primary key, Microsoft Access asks if you want Access to create one for you when you save the table.- When you are ready to save your table, on the File menu, click Save, and then type a unique name for the table.