csc 240 (blum)1 forms and importing data in access

Post on 13-Jan-2016

221 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

CSC 240 (Blum) 1

Forms and Importing Data in Access

CSC 240 (Blum) 2

Highlight the Customer Table, click on the Create

tab and then on the Form icon.

CSC 240 (Blum) 3

Customer form generated.

CSC 240 (Blum) 4

A customer’s data is shown in the main part of the form and that customer’s orders are shown in the “subform”

subform

CSC 240 (Blum) 5

• One can use the form’s navigation arrows (not to be confused with the subform’s navigation arrows) to move through the customer records. Back one record Forward one record– | Back to first record | Forward to last record * New record

• One can also use the form to enter data a new customer record or the subform to enter a new order record.

subform

form

CSC 240 (Blum) 6

Use the subform to place another order for Jane Doe.

CSC 240 (Blum) 7

Close the form, you should be prompted to save it.

CSC 240 (Blum) 8

Open up the Order table and note that the new

record appears there.

Use the drop-down list on the left-hand side to choose Forms

CSC 240 (Blum) 9

CSC 240 (Blum) 10

Use the Customer Form to add another customer.

CSC 240 (Blum) 11

Close the form and open the Customer table to

verify that the new customer was added.

CSC 240 (Blum) 12

Return to the Customer form and go over to

Design View.

CSC 240 (Blum) 13

Right click in the open form area, choose Fill/Back Color

from the menu, then select a color from the palette.

CSC 240 (Blum) 14

Place the cursor near the right edge of the form, it should become a double headed arrow. Drag the arrow to increase the size of the form.

CSC 240 (Blum) 15

Clicking on it a second time allows one to change

the text, make it say First Name.

CSC 240 (Blum) 16

Click on something else and then click on the label-textbox combination. You can get double-headed arrows on either side of the label or textbox use them the adjust the sizes. They all moved together.

CSC 240 (Blum) 17

Right click on the label and choose Properties.

CSC 240 (Blum) 18

See the Property Sheet on the right.

CSC 240 (Blum) 19

Rearrange the other labels and textboxes to make a more presentable form. (I could move things after I cut and paste them.)

CSC 240 (Blum) 20

Look at the form in Form View

CSC 240 (Blum) 21

One may need to return to design view to make adjustments for instance shrinking the state textbox.

CSC 240 (Blum) 22

Adjustments to the size of the columns in the subform can be made in Form View. Place the cursor between two columns, when it becomes a double-headed arrow, drag to adjust the column size. Changing the subform is really changing the Order table.

CSC 240 (Blum) 23

Go to the US House of Representatives site and download (right click/Save target as) the Excel Spreadsheet list of members.

CSC 240 (Blum) 24

Open the file with Microsoft Excel.

Next go to the Telephone Directory

CSC 240 (Blum) 25

Highlight and copy the data. Since we will paste into Excel (Microsoft) it is best to use Internet Explorer (also Microsoft)

CSC 240 (Blum) 26

Paste it into Excel – make sure the names line up.

CSC 240 (Blum) 27

Delete the column with the duplicate name information. Save.

CSC 240 (Blum) 28

CSC 240 (Blum) 29

Start a new database. Go to the External Data Tab and click on Excel

CSC 240 (Blum) 30

Select the file and click Open.

Choose the Import option.

CSC 240 (Blum) 31

CSC 240 (Blum) 32

Check the box indicating that the first row contains the field names as opposed to just containing other data.

Chose “Do not import” for the Prefix field

CSC 240 (Blum) 33

Rename the field names – spaces in field names are trouble

CSC 240 (Blum) 34

Decide what to do about primary key

CSC 240 (Blum) 35

Wizard

CSC 240 (Blum) 37

Wizard 2

CSC 240 (Blum) 38

Wizard 3

CSC 240 (Blum) 39

Result from Wizard

CSC 240 (Blum) 40

I dragged RepFirstName back to Table2 and then RepState (DC) and RepCity (Wash.) to Table3

CSC 240 (Blum) 41

Highlight a table and click on the rename table button and rename the tables.

CSC 240 (Blum) 42

More wizard

CSC 240 (Blum) 43

Even more Wizard

CSC 240 (Blum) 44

Allow it to create query that recreates original input

CSC 240 (Blum) 45

CSC 240 (Blum) 46

Examine the tables and query in DataSheet view.

CSC 240 (Blum) 47

Make a parameterized query that lists the

members from a state entered by the user.

CSC 240 (Blum) 48

Create the query below that list the states and the number (count) of representatives. The Total row is obtained by clicking on the button.

CSC 240 (Blum) 49

Results of the counting query.

CSC 240 (Blum) 50

SQL View of the counting query.

CSC 240 (Blum) 51

We can give the column a different name by

editing the SQL statement.

CSC 240 (Blum) 52

Save and run. Results with renamed column.

CSC 240 (Blum) 53

Start a new query and go to SQL view. Enter

the text seen below.

CSC 240 (Blum) 54

We now have “firstname lastname” as a

single field in the query results.

top related