19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

344 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

2. (Optional) Specify a primary key for a table.<br />

(a)Highlight the table name in the Database window.<br />

(b) Press the right mouse button <strong>and</strong> choose Design to invoke the Table Structure<br />

window (Figure 11-5).<br />

(c) Press the Add Index button to invoke the Add Index window (Figure 11-6)<br />

<strong>and</strong> follow the steps listed after the figure.<br />

3. Place records into a table.<br />

(Note: The VisData toolbar contains three sets of icons. This discussion<br />

assumes that the left icon of each of the first two sets has been selected. These<br />

are the “Table type Recordset” <strong>and</strong> “Use Data Control on New Form” icons.)<br />

(a) Double-click on the table in the Database window to invoke the Table window<br />

(Figure 11-7).<br />

(b) Follow the directions listed after Figure 11-7.<br />

FIGURE 11-5 Table Structure Window. (Invoked from the Database Window with the Right<br />

Mouse Button by Choosing New or Design.)<br />

How to use the Table Structure window<br />

1. Type the name of the table in the Table Name text box.<br />

2. Click on the Add Field button. (An Add Field window will be displayed.)<br />

3. Type the name of a field in the Name text box.<br />

4. Click on the down arrow of the Type combo box <strong>and</strong> select a type from the<br />

dropdown list. (We use primarily the type “Text” for string, <strong>and</strong> “Single” or<br />

“Integer” for numbers.)<br />

5. If the data type is “Text,” type the length of the largest possible string needed<br />

in the Size box. (For instance, length 20 should suffice for names of cities. The<br />

length must be no longer than 255 characters.)<br />

6. Press OK to add the field to the table.<br />

7. Repeat Steps 3 through 6 until you have added all the fields to the table. When<br />

you are through, click on the Close button to return to the Database window.<br />

8. To delete a field, highlight the field by clicking on it in the list box <strong>and</strong> then<br />

press the Remove Field button.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!