AIA101.1.MS Access Tables & Data


Published on

1st Module of Accelerated Introduction to Microsoft Access. covers tables, import/export and relationships

Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

AIA101.1.MS Access Tables & Data

  1. 1. Factory Access Accel. Introduction v1.021 Accelerated Introduction to Access ModuleModule Introduction to Access, Tables, and External Data P.O. Box 6142 Laguna Niguel, CA 92607 949-489-1472
  2. 2. FactoryAccess Accel. Introduction v1.022 Module Outline  Part 1: Introduction & Tables  Part 2: External Data  Part 3: Relating Tables Three parts:Three parts:
  3. 3. FactoryAccess Accel. Introduction v1.023 Module Hands On – Create working folder with supplied files – Create a database – Create 3 tables (w/validation rules and masks) – Populate tables – Import and Export Tables – Create permanent links – Create a simple query – Compute calculated field(s) – Create a multi-table query with summary aggregates Students “hands-on”:
  4. 4. Factory Access Accel. Introduction v1.024 Accelerated Introduction to Access Part 1:Part 1: Introduction to Access and Tables
  5. 5. FactoryAccess Accel. Introduction v1.025 But first - Create Folder  Create a folder yourname (or similar) in My Documents – this is where your database and other files will go.  Optionally, copy in the labor.txt and employees.xls files from the instructor supplied location or CD.
  6. 6. FactoryAccess Accel. Introduction v1.026 Access Modes  Menu-driven interface - Interact with a database and its objects using menu commands  Program mode - Lets you store instructions in a VBA program file  This course concentrates on the menu interface but does cover macros which can be used to “program” a series of actions
  7. 7. FactoryAccess Accel. Introduction v1.027 Database Terminology  Database – in Access a repository in which tables, reports, queries, and other objects are stored  Table – stores facts about one subject (entity)  Record - contains related information about an entity “instance”  Field - contains a fact about an entity  Relational Database - allows you to link records from two or more tables based on the contents of a common field. Access is a relational database.
  8. 8. FactoryAccess Accel. Introduction v1.028 Database Terminology (cont.)  Key - used to order, identify, and retrieve records in the database  Primary key - unique identifier for a particular record. Only one per table.  Index – like a book index. Speeds searches and joins. Can have many per table.  Table structure - the arrangement of information within a record, the type of characters, field length, limitations, etc.
  9. 9. FactoryAccess Accel. Introduction v1.029 Database Terminology (cont.)  Object – used in database world as generic term for queries, reports, indexes, tables, etc. Not the same as programming object.  Form - paper-like method of accessing and entering data in a table  Query – retrieves information from Access tables  Report - provides the ability to arrange table data as well as to perform calculations and then print a paper-based report
  10. 10. FactoryAccess Accel. Introduction v1.0210 Sample Application – Factory2000  Simple cost accounting application  Employees work on work orders  Clock labor hours for each work order
  11. 11. FactoryAccess Accel. Introduction v1.0211 Recording Factory2000 Labor Hours EmpNo fName lName Rate Wono Descr Hours 12 Bob Smith 15 A1 Casting 12 13 Mary Chavez 20 A1 Casting 22 14 Alicia Parks 25 B3 Ass’ly 15 14 Alicia Parks 25 C2 Screws 18 What problems do you see with this approach?
  12. 12. FactoryAccess Accel. Introduction v1.0212 Factory2000 Relational Database Structure EmpNo fName lName Rate MgrNo 12 Bob Smith 15 13 13 Mary Chavez 20 14 Alicia Parks 25 12 EmpNo Wono Start End Hours 12 A1 1/1/01 1/31/01 20 14 C2 2/1/01 2/28/01 42 14 B3 1/1/01 2/28/01 40 employeesemployees LaborLabor Wono Descr Std A1 Casting 30 B3 Fitting 50 C2 Screws 70 Work_ordersWork_orders
  13. 13. FactoryAccess Accel. Introduction v1.0213 Creating a Database  Ways to create a database – Create a database using an Access template or Wizard – (not always recommended) – Create a blank database and then insert your own objects – we will use this method in this course
  14. 14. FactoryAccess Accel. Introduction v1.0214 Creating an Access 2000 Database Create the database in your desktop folder with a meaningful name
  15. 15. FactoryAccess Accel. Introduction v1.0215 Creating a Table  Click new from tables tab  Naming a Table – Up to 64 “standard” characters can be used – Do not use an extension – No leading spaces or control characters, in fact try to avoid spaces altogether  Add fields one by one  Set Field Properties in Field Properties box
  16. 16. FactoryAccess Accel. Introduction v1.0216 Designing Fields  Field Type – text, datetime, number, etc.  Field Width – 10 characters, etc.  Caption – “Column title” for display  Format – Determines how the field is displayed (long date, short date, etc.)  Click toolbar key symbol to make primary key  Set indexed for secondary keys, required, etc.
  17. 17. FactoryAccess Accel. Introduction v1.0217 Setting Properties in the Table Designer
  18. 18. FactoryAccess Accel. Introduction v1.0218 Hands On - Create Tables  Employees  Work_Orders  Labor
  19. 19. FactoryAccess Accel. Introduction v1.0219 Employees Table Definition  EmpNo text(2), primary key  Fname text(10)  Lname text (15), required  Rate currency, required  MgrNo text(2) (Instructor led) All with captionsSave as tblEmployees
  20. 20. FactoryAccess Accel. Introduction v1.0220 Work_Orders Table Definition  WoNo text(2), primary key  Descr text(15)  StdHrs number(single,2), required  Accum number(single,2), required (On your own) Add captions, tooSave as tblWork_orders
  21. 21. FactoryAccess Accel. Introduction v1.0221 Labor Table Definition  EmpNo text(2), primary key  WoNo text(2), primary key  Start datetime, required  End datetime  Hours number(single,2) (On your own) Add captions, tooSave as tblLabor
  22. 22. FactoryAccess Accel. Introduction v1.0222 Field Validation & Masks  Add some validations – Test a numeric field for > 0 – Try checking one field against another – Etc.  Add captions if not added already  Add an input mask  Change a display format  Etc.
  23. 23. FactoryAccess Accel. Introduction v1.0223 Datasheets  Datasheet window - displays the contents of a table in a spreadsheet-like format – Each row contains a record – Each column contains a field  Speedbar - appears at the bottom of the window and is used to navigate through the records in a table
  24. 24. FactoryAccess Accel. Introduction v1.0224 Datasheet View
  25. 25. FactoryAccess Accel. Introduction v1.0225 Entering & Editing Records  Enter table data from the handouts or use your own data
  26. 26. FactoryAccess Accel. Introduction v1.0226 Employees Table Data
  27. 27. FactoryAccess Accel. Introduction v1.0227 Work_Orders Table Data
  28. 28. FactoryAccess Accel. Introduction v1.0228 Labor Table Data [To be imported later]
  29. 29. FactoryAccess Accel. Introduction v1.0229 Printing a Table  Access allows you to create “quick and dirty” reports by clicking the toolbar Print button – A row/column presentation is used – Field names appear along the top – Records are rows – Fields are columns – A grid is printed around each field
  30. 30. FactoryAccess Accel. Introduction v1.0230 Quick Reports  Report Wizard – Module 2 covers reports – For now, be aware a quick report can be produced using the report wizard
  31. 31. Factory Access Accel. Introduction v1.0231 Microsoft Access Part 2Part 2 External Data
  32. 32. FactoryAccess Accel. Introduction v1.0232 Office Links  Publish it with MS Word  Analyze in MS Excel  Use Tools | Office Links or the Toolbar
  33. 33. FactoryAccess Accel. Introduction v1.0233 Exporting a table  Very simple  Click File|Export (or save as)  Specify type: Access can export to many types: Excel, Text, etc.
  34. 34. FactoryAccess Accel. Introduction v1.0234 Exporting tables  Export Work_Orders to CSV text file.  Note you can also export to another Access table. Even one elsewhere on a LAN!
  35. 35. FactoryAccess Accel. Introduction v1.0235 Using External Data  Two methods: – Import the data into a new (or existing table) in your database – Link to the data. A table link appears in your database but the data stays in the original file.
  36. 36. FactoryAccess Accel. Introduction v1.0236 Importing Files  Another very important feature  Start from new table dialog, pick Import Table  It will start a wizard  Use advanced to select fields, etc.  Specifications can be saved for later use
  37. 37. FactoryAccess Accel. Introduction v1.0237 Importing a table from a Text File Importing a Text File
  38. 38. FactoryAccess Accel. Introduction v1.0238 Importing from a text file  Import the instructor-supplied labor text file into the previously created labor table  Save the specification
  39. 39. FactoryAccess Accel. Introduction v1.0239 Linking a table  Use new table dialog  Select Link Table  This will set up a connection to an external table. It does not become part of the Access database  Access can link to many types: Excel, ODBC connection, etc.
  40. 40. FactoryAccess Accel. Introduction v1.0240 Linking a table Linking a Table
  41. 41. FactoryAccess Accel. Introduction v1.0241 Link a table  Link the instructor- supplied Employees Excel  Give it a name like Employees_xls
  42. 42. Factory Access Accel. Introduction v1.0242 Microsoft Access Part 3Part 3 Relating Tables
  43. 43. FactoryAccess Accel. Introduction v1.0243 Relating Tables  Command sequence – Tools | Relationships  Parent table - table used as the main table for a relationship  Child table - the related table, often has several records for each record in the parent table
  44. 44. FactoryAccess Accel. Introduction v1.0244 Referential Integrity  Orphan record - a child record without a corresponding parent record  Referential integrity - makes certain that related records are present
  45. 45. FactoryAccess Accel. Introduction v1.0245 Table Links  In this context means relate two or more tables on columns of data  Permanent link – – established using the Relationships command – is always in effect once defined  Transient link - defined using the query-by- example feature of Access
  46. 46. FactoryAccess Accel. Introduction v1.0246 Creating a Permanent LinkCreating a Permanent Link Drag from PK to FK
  47. 47. FactoryAccess Accel. Introduction v1.0247 Create Permanent Links Link all Factory2000 tables Enforce referential integrity Normal, default joins for now
  48. 48. FactoryAccess Accel. Introduction v1.0248 Permanent Links
  49. 49. FactoryAccess Accel. Introduction v1.0249 Import Labor Table  Now import the instructor supplied labor.txt file into your labor table  Try changing an EmpNo or WoNO to an invalid value and see what happens
  50. 50. Factory Access Accel. Introduction v1.0250 Accelerated Introduction to Access End of Module P.O. Box 6142 Laguna Niguel, CA 92607 949-489-1472