Access Tables, Forms, Queries, Reports Grade Sheet Criteria Build a business database: Link Multiple Tables into 1 Relational Database relevant to YOUR own business. . Continue to follow your overall business design theme as much as possible. Use PDF Tutorial: http://faculty.scf.edu/winterf/0ClassFolders/1570Office/1GradingCriteria/Access_PictorialTutorial.pdf Also see: http://faculty.scf.edu/winterf/0ClassFolders/1570Office/1GradingCriteria/Access_Images/ http://faculty.scf.edu/winterf/0ClassFolders/1570Office/SamplesDataBases/ Relationships are set by linking tables though Key Fields. When tables are linked or related it means that you only enter data like LastName, FirstName and Address one time, perhaps in the Employee table. If you link the Employee table to another table by its key field, such as EmployeeID, you can obtain LastName, FirstName and Address… without retyping this data – saving storage space, saving time, avoiding redundancy, and reducing possible errors. Note 1: Relationships: The Primary Key is usually the first field listed in a table. Ex: EmployeeID should be the Primary field and the first field listed in the Employees table. Ex: EmployeeID may be Foreign key in the Invoices table. As a rule, there should only be one Primary key per table. Normally, do not link a Primary Key to a Primary Key. Link a Primary Key to a Foreign Key (no key symbol). Other than the Key fields, you should not have any other field listed in multiple tables. Avoid Redundancy. Ex: If Price is in the Products table, it should not be in the Invoices table. The Invoice table gets Price from its relationship to the Products table through ProductID. If your Relationship window shows a duplicate of the same table (Ex: there is an Employees and Employees_1): Right click on the Relationship line of the duplicate table (Ex: Employees_1) and click Delete. Then select the duplicate table (Ex: Employees_1) and Delete the Table. (You may have to close opened tables first.) If the Primary key for ProductNumber is a Text data type in the Products table, then the foreign key for ProductNumber must also be a Text data type in the linked Orders table. (Notice I wrote ProductNumber is Text because it may be: IBM1234 which is really alphanumeric.) Also note that you can type "Relationships" into the help box and get a lot of help on this topic including Troubleshooting. Note2: In form Design View, to Disassociate Labels and their associated TextBoxes or a collection of Labels and TextBoxes (the Form Wizard will associate a whole collection) – highlight the Label(s) and TextBox(es) > Right-click > Layout > Remove. This will allow you to independently move and resize Labels and/or TextBoxes. Note 3: Reduce File Size: I. Office Button > [Access Options] button > Current Database, check Compact on close. II. Make sure images are small in size. A typical photo from a digital camera can be 8” x 11” or even poster size and possibly 3 MB. So for some images you must first load them in a Paint program and then reduce their file size. (Most paint programs have a resize option, ex: Image > Resize). Sometimes it is better to delete every picture and image in your database. (If you have to temporarily delete the entire picture field.) Then check the file size. If you see it is much smaller, then you have confirmed the problem is your images. Now you can add smaller images back in. If necessary, just add a few images for the first few records. Also note – if you are using Office 2007 use the Attachment data type to add pictures, NOT OLE object. Microsoft had a bug with its OLE pictures which tremendously increased the file size. III. Make sure you have no spaces or characters in the file name. If I.-III. do not work, try to send as a .zip file for a small penalty. Also see: http://faculty.mccfl.edu/WinterF/0ClassFolders/Common/FileSizes-KeepSmall.htm Quick Pictorial Tutorials: Create Table | Create Query | Create Form | Create Report | Set Relationships | Sample Relation Competency Steps Points Build a Clients Table. Include the following fields and any desired fields: EmployeeIS: Primary Key (When done, the primary key will have a key icon next to its field name.) LastName: Text FirstName: Text Address1: Text Address2: Text City: Text State: Lookup Wizard. See the General tab to set the Field Size to 2 and Format to > (uppercase) and Default to “FL” Zip: Text Phone: Text Email: Hyperlink A Date field such as hire or birth date A Currency or Number field to be used in a calculation later, ex: MonthlyDues A Yes/No field such as Graduate A Memo field such as Notes Create at least two additional tables linked to your main Table: Suggestion – Invoices linked to Invoice Details; Employees or Products or Customers linked to Invoices Set your Relationships (link your tables): Primary Key linked (related) to Foreign Key. Ex: Products.ProductID (table.field with Primary key) linked to Invoices.ProductID (Foreign key) The Primary key should be 1st field in table. In Office 2007 create a Table in Design View for your ongoing business project 1. Start Access 2. Click Blank Database 3. Enter a File Name and click the [Create] button - pay attention to the Path! (You can click the folder icon to browse to the desired path). Give the file a logical name like BestInventory not Database1. 4. Click Create Tab 5. Click Table Design button 6. Enter Field Names in column 1 & Data Types in column 2 in the table design window. 7. In the Field Properties Window at the bottom of the screen, set the appropriate field sizes, formats, and default values. 8. Close the table design window and Save when Prompted 9. Open the table that you just created. (Home > View > Datasheet view). The field names make up the header on the top row. You can now start entering the actual data in the second, third, fourth… rows. Give the table a logical name like Clients, Employees, and Products, not Table1, Table2, and Table3. (Give it a good name up front or right-click an object to rename it.) Database Tools tab > Relationships Add tables (if necessary) and drag Primary key (∞) to Foreign key, and set “Referential Integrity” Use the Form Wizard to create a simple but attractive Form in Columnar layout. If you want to use dropdowns linking to another table see: LookupWizard.doc Create tab > More Forms > Form Wizard A good form has one record on one screen in Columnar layout Format, move, and align all the Form controls so that everything is lined up and attractive. Examples: Headers like Invoice Date and ProductName should have spaces in them instead of InvoiceDate and ProductName. These spaces are added in Design View. Also in Design View the column widths should be adjusted to give the best presentation. Use the Form Wizard to create a simple but attractive Select a control > Use Format tab Create tab > More Forms > Form Table1 for Employees: 10pts 2 Other related Tables: 20pts Relationships: 10pts Good Form1 for Employees with employee pictures and email addresses 10pts Good Form2 for Form in Columnar layout. If you want to use dropdowns linking to another table see: LookupWizard.doc Wizard A good form has one record on one screen in Columnar layout Use the Report Wizard to create a simple Sorted Report based on the Table – no Totals. Suggestion: Employee Addresses or Product Description. Start the report name with a 1. See: Sample Report and Terms This report will show multiple records on one page in Tabular layout. To see a simple some sample databases with relationships and a query see: faculty.scf.edu/winterf/0ClassFolders/1570Office/SamplesDataBases/ Create a Query in Design View that uses multiple tables - such as Invoices and Products, that Calculates and Formats Totals such as.: SubTotal: [Price]*[Qty] or something similar. or/and Tax: [Price]*[Qty] * .07 or/and LineTotal: SubTotal + Tax Or LineTotal: [Price]*[Qty] + [Price]*[Qty] * .07 To Format a field for currency or decimals: Right-click, choose Properties, choose Format See: Sample Report with SubTotals Create a second Report based on the Query above that uses multiple tables and displays Line Totals, Group Subtotals, and a Grand Total. Such as a Line Total for one item, Group Totals showing sales for each employee, and a Grand Total for all employee. Start the report name with a 2. Use appropriate and consistent Formats for all columns. See: Access_ReportWithTotals_Scott.pdf All Reports should have Title (ex: Company Name) and Subtitle (ex: Pay Roll Report) and Date. To get the Group Totals to work – you must have a product that is sold multiple times or a sales person that makes multiple sales… Then sort on that product field or salesperson field. Finally, select that product field or salesperson field to Group by when you run the Report Wizard. If you do everything OK, then you can click the [Summary] button with the Report Wizard. This report shows multiple records on one page in Tabular layout. All Reports should have Title (ex: Company Name) Subtitle (ex: Pay Roll Report), and Date. All reports should be neatly lined up and appropriately justified LastName in Detail header should appear as Last Name. Delete any practice or nonworking reports, forms, queries 1. Click Create Tab 2. Click Query Design Button 3. In the Show Table dialog box: Select 1st Table (such as Invoices) and click [Add.]. Select 2nd Table (such as Products) and click [Add.]. to produce a Query for a Report like Date Product Price Qty Subtotal Tax Total 1. Click Create Tab 2. Click Report Wizard 3. In the Tables/Queries dialog box: Select your Query and select the fields [>>], [Next]. 4. If necessary, select the Field you want to group on for Subtotals [Next] 5. If your query is based on related tables that have a calculation, there will be a [Summary] button that will allow you to do group and Grand Totals. (Or Format tab > Totals button > Sum) This report will show multiple records on one page in Tabular layout. Invoices 10pts Report 1: 10pts Query with a Calculation: 10pts Report 2: 10pts Group & Grand Totals: 5 (Hint Sort first) Appropriate and consistent Formats Make sure all Report columns are properly sized and the headers are appropriately aligned (Point to column heading boundary and use double-Headed arrow to size) Do not have any forms queries, reports that do not work. Delete any extra forms. Right-click and rename any non-descriptive tables, forms queries, or reports Note: in Microsoft Access, all the tables, forms and reports are stored in one .accdb file. This is the same file that you started with in your first Access assignment. Give the Report a logical name like Employee Sales not Report1. (Give it a good name up front or right-click an object to rename it.) Query1 is not a descriptive or acceptable name. Do not have extra vertical or extra horizontal space in your forms and reports. Go into design view and make everything look attractive When you open Invoices.accdb, Access creates a temporary Record Locking file called Invoices.laccdb (L is for Locked). (Do not send me the laccdb file : -) Everything is neatly aligned, labeled: 10pts Total 100