CS614 Solution help

No Comments
hope this may help u all 

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.

If you want to modify the table that the Table Wizard creates, open the table in Design view when you have finished using the Table Wizard. 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.

As mentioned earlier, Microsoft Access will assign data types to each field (column) based on the kind of data that you entered. If you want to customize a field's definition further--for example, to change a data type that Access automatically assigned, or to define a validation rule--open the table in Design view.

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 Name>: 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.
Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment