Lesson 3: Working with Microsoft Access Tables
After you create an Access table, you can modify it, enter data into it manually or import data from somewhere else, such as Excel. This lesson teaches you how to modify a table and enter data.
Enter Records
After you have created a table, you can enter data into it.
To enter data into an AutoNumber field:
- Press the Tab key. When you make an entry into another field in the record, Access will automatically make an entry into the AutoNumber field.
To enter data into fields that have a lookup list:
- Click the down-arrow that appears when you click in the field.
- Click to select the entry you want.
- Press the Tab key.
To enter data into a Yes/No field:
- Click the checkbox for Yes; leave the checkbox unchecked for No.
To add an attachment to an attachment field:
- Double-click in the attachment field. The Attachments dialog box appears.
- Click Add. The Choose File dialog box appears.
- Click the file you want to add.
- Click Open. The Choose File dialog box closes.
- Click OK. Access attaches the file.
Note: You can attach multiple files to a single attachment field.
To enter data into a date field:
- Type the date.
Or
- Select the date from the calendar that appears to the left of the field when you click in the field. You click the calendar to open it. Use the left-arrow at the top of the calendar to move to the previous month; use the right-arrow at the top of the calendar to move to the next month. When you reach the proper month, click the proper date.
To add data to an OLE Object field:
An OLE object is an object such as a Word document or an Excel Spreadsheet.
- Right-click in the field. A menu appears.
- Click Insert Object. The Microsoft Office Access dialog box appears.
Create New:
- Click the Create New radio button if you want to create a new object.
- Click the object type you want to create.
- Click OK. Access opens the program for the object type you selected. You can create the object.
- Create the object and then close the program for the object type you selected. Access links to the object.
Create From File:
- Click the Create From File radio button if you want to use an existing file.
- Type the path to the file or click the Browse button and locate the file.
- Click OK. Access links to the object.
To add data to other field types:
For all other fields, type your entry and then press the Tab key.
Import a Table into Access from Excel
Excel organizes data into columns and rows. If you have data in Excel that you want to use in Access, you can import those columns and rows into Access by using the Excel Spreadsheet Wizard.
To import data from Excel:
Open the Excel Spreadsheet Wizard
- Activate the External Data tab.
- Click the Excel button in the Import group. The Get External Data – Excel Spreadsheet Wizard appears.
- Click the Browse button. The File Open window appears.
- Locate the spreadsheet you want to import.
- Click the Open button. The path to the file you selected appears in the File Name field.
- Click OK. Access moves to the next page.
Choose the sheet or named range you want to import
When importing from Excel, you can import an entire worksheet or a named range. To import a worksheet, click the Show Worksheets radio button and then click the worksheet you want. To import a named range, click the Show Named Ranges radio button and then click the named range you want.
- Click Show Worksheets to import a worksheet, or click Show Named Ranges to import a named range.
- Click the worksheet or named range you want to import.
- Click Next. Access moves to the next page.
Make the first row your field names
When you create a worksheet in Excel, the first row can contain column headings. If this is the case, click First Row Contains Column Headings, otherwise click Next.
- Click First Row Contains Column Headings if the first row of your Excel spreadsheet contains column headings.
- Click Next. Access moves to the next page.
Set data types
Access attempts to assign the correct data type to each column. You can view the assignment made by Access and then make changes. An Index speeds up Access’s ability to search a column. You can use the Indexed field to assign an index. The Yes (Duplicates OK) option creates an index in which duplicate values in the field are allowed; the Yes (No Duplicates) option creates an index in which duplicate values in the field are not allowed. The primary key should be indexed and you should use the Yes (No Duplicates) option. You can also skip fields you do not want to import.
- Click a column heading to select a column.
- Type the Access table’s column heading in the Field Name field.
- Choose a Data type.
- Indicate if the field should be indexed and, if so, select the type of index.
- Check the Do Not Import Field box for any column you do not want to import.
- Click Next. Access moves to the next page.
Choose a primary key
You can let Access assign the primary key, choose the primary key yourself, or have no primary key by selecting the correct option on this page.
- Click to choose the proper radio button. If you want Access to add the primary key, click Let Access Add Primary key. If you want to add the primary key, click Choose My Own Primary Key and then click the down-arrow and select the field you want to use as the key field. If you do not want to add a primary key, click No Primary Key.
- Click Next. Access moves to the next page.
Name your table
- Type the name you want to give your table.
- Click Finish. Access moves to the next page.
- Click Close. Access imports the table.
Modify a Table
After you create a table, you may need to modify it. You can delete columns, insert columns, or move columns.
Delete Columns
The Delete option permanently deletes columns and all the data contained in them. You cannot undo a column delete.
To delete columns:
- Click and drag to select the columns you want to delete.
- Activate the Datasheet tab.
- Click Delete in the Fields & Columns group. A prompt appears.
- Click Yes. Access deletes the columns you selected.
Insert Columns
The Insert option inserts a column before the selected column.
To insert a column:
- Click the column head of the column before which you want to insert a column.
- Activate the Datasheet tab.
- Click Insert in the Fields & Columns group. Access inserts a new column.
Tip: If you right-click a column label, you can use the menu that appears to insert or delete columns.
To delete a column:
- Right-click the column head you want to delete. A menu appears.
- Click Delete Column.
To insert a column:
- Right-click the column head before which you want to insert a column. A menu appears.
- Click Insert Column.
Move a Column
You can use the Move option to move a column from one location to another.
To move a column:
- Move your mouse pointer over the horizontal line under the column label. Your mouse pointer turns into a four sided arrow.
- Press your left mouse button
- Click and drag the field to the new location. A dark line appears at the new location.
- Release you left mouse button. Access moves the column.
Move around a Table
Access provides several methods for moving around a table. On the Home tab, there is a Go To button. When you click it, a menu of options appears. You can use the menu to go to the first, last, previous, or next record in your table. You can click the New option to add a new record. You can also use special keys and the navigation bar in Access to move around a table. The navigation bar appears at the bottom of the table.
To use the Go To button to move around a table:
- Activate the Home tab.
- Click the Go To button in the Find group. A menu appears.
- Click First to go to the first record, Previous to go to the previous record, Next to go to the next record, Last to go to the last record, or New to create a new record.
Tip: You can also create a new record by choosing the Home tab and then clicking New in the Records group.
To use keys to move around a table:
Key to Press | Action |
Tab | Moves to the next field to the right. If you are in the last field in a record, moves you to the next record. If you are in the last record in a table, creates a new record. |
Left-Arrow | Moves to the next field to the left. If you are in the first field in a record, moves you to the previous record. |
Shift+Tab | Moves to the previous field. If you are in the first field in a record, moves you to the previous record. |
Right-Arrow | Moves to the next field. If you are in the last field in a record, moves you to the next record. If you are in the last record in a table, creates a new record. |
Up-Arrow | Moves you up one record. |
Down-Arrow | Moves you down one record. |
Ctrl++ | Creates a new record. |
To use the Navigation bar to move around a table:
1 | Go to First Record |
2 | Go to Previous Record |
3 | The Current Record |
4 | Go to Next Record |
5 | Go to Last Record |
6 | Create a New (Blank) Record |
Select Columns and Rows
Before you can perform an operation on a column or row, you must select it. To select a column, click the column head. To select several columns, click a column head and then drag. To select a row, click the blank area to the left of the row. To select several rows, click the blank area to the left of a row and then drag. To select the entire table, click the Select All button in the upper-left corner of the table.
Delete a Record
If enter a record by error, you can delete it.
To delete a record:
- Select the record you want to delete.
- Activate the Home tab.
- Click Delete in the Records group. A prompt appears.
- Click the Yes button.
Or
- Select the record you want to delete.
- Right-click. A menu appears.
- Click Delete Record. A prompt appears.
- Click the Yes button.
Resize a Column or Row
If all of the information in a column or row does not display, you may want to make the column or row larger. If you want to fit more information on the screen, you may want to make a column or row smaller. In either case, you can click and drag to increase or decrease column width or row height.
To resize a column or row:
- Place the cursor over the line that separates two columns or two rows. The cursor turns into a double-sided arrow.
- Hold down the left mouse button and drag to increase or decrease the width of a column or the height of all of the rows.