Categories

Followers

Search This Blog

1 Jan 2012

Access-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:

Lookup List
  1. Click the down-arrow that appears when you click in the field.
  2. Click to select the entry you want.
  3. Press the Tab key.

To enter data into a Yes/No field:

Yes/No Field
  • Click the checkbox for Yes; leave the checkbox unchecked for No.

To add an attachment to an attachment field:

Attachment 1
  1. Double-click in the attachment field. The Attachments dialog box appears.
  2. Click Add. The Choose File dialog box appears.
Attachment 2
  1. Click the file you want to add.
  2. Click Open. The Choose File dialog box closes.
Attachment 3
  1. 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.
Date 1
Date 2

To add data to an OLE Object field:

An OLE object is an object such as a Word document or an Excel Spreadsheet.
OLE 1
  1. Right-click in the field. A menu appears.
  2. Click Insert Object. The Microsoft Office Access dialog box appears.

Create New:

OLE 2
  1. Click the Create New radio button if you want to create a new object.
    1. Click the object type you want to create.
    2. Click OK. Access opens the program for the object type you selected. You can create the object.
    3. Create the object and then close the program for the object type you selected. Access links to the object.

Create From File:

OLE 3
  1. Click the Create From File radio button if you want to use an existing file.
    1. Type the path to the file or click the Browse button and locate the file.
    2. 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
Excel Wizard Step 1
Excel Wizard Step 2
  1. Activate the External Data tab.
  2. Click the Excel button in the Import group. The Get External Data – Excel Spreadsheet Wizard appears.
  3. Click the Browse button. The File Open window appears.
  4. Locate the spreadsheet you want to import.
  5. Click the Open button. The path to the file you selected appears in the File Name field.
  6. 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.
Excel Wizard Step 2
Excel Wizard Step 2
  1. Click Show Worksheets to import a worksheet, or click Show Named Ranges to import a named range.
  2. Click the worksheet or named range you want to import.
  3. 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.
Excel Wizard Step 3
Excel Wizard Step 3
  1. Click First Row Contains Column Headings if the first row of your Excel spreadsheet contains column headings.
  2. 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.
Excel Wizard Step 4 Excel Wizard Step 4
  1. Click a column heading to select a column.
    1. Type the Access table’s column heading in the Field Name field.
    2. Choose a Data type.
    3. Indicate if the field should be indexed and, if so, select the type of index.
    4. Check the Do Not Import Field box for any column you do not want to import.
  2. Click Next. Access moves to the next page.
Choose a primary key
Excel Wizard Step 5
Excel Wizard Step 5

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.
  1. 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.
  2. Click Next. Access moves to the next page.
Name your table
Excel Wizard Step 6
Excel Wizard Step 6
  1. Type the name you want to give your table.
  2. Click Finish. Access moves to the next page.
  3. 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:

Delete Column
Delete Column
  1. Click and drag to select the columns you want to delete.
  2. Activate the Datasheet tab.
  3. Click Delete in the Fields & Columns group. A prompt appears.
  4. Click Yes. Access deletes the columns you selected.
Insert Columns
The Insert option inserts a column before the selected column.

To insert a column:

Insert Column
  1. Click the column head of the column before which you want to insert a column.
  2. Activate the Datasheet tab.
  3. Click Insert in the Fields & Columns group. Access inserts a new column.
Tip Tip: If you right-click a column label, you can use the menu that appears to insert or delete columns.

To delete a column:

  1. Right-click the column head you want to delete. A menu appears.
  2. Click Delete Column.

To insert a column:

  1. Right-click the column head before which you want to insert a column. A menu appears.
  2. 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:

  1. Move your mouse pointer over the horizontal line under the column label. Your mouse pointer turns into a four sided arrow.
  2. Press your left mouse button
  3. Click and drag the field to the new location. A dark line appears at the new location.
  4. 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:

Move Around with Go To Button
Move Around with Go To Button
  1. Activate the Home tab.
  2. Click the Go To button in the Find group. A menu appears.
  3. 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 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:

Navigation Bar
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.
Select Column
Select Column
 
Select Rows
Select Rows

Delete a Record

If enter a record by error, you can delete it.

To delete a record:

  1. Select the record you want to delete.
  2. Activate the Home tab.
  3. Click Delete in the Records group. A prompt appears.
  4. 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:

  1. Place the cursor over the line that separates two columns or two rows. The cursor turns into a double-sided arrow.
  2. 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.