Microsoft Access 2013 V
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to Microsoft Access 2013 v. 3.0 October 2014 nikos dimitrakas SU/DSV Introduction to MS Access 2013 October 2014 KTH/ICT/SCS v 3.0 nikos dimitrakas Table of contents 1 Introduction ............................................................................................................................ 4 1.1 Microsoft Access .......................................................................................................................... 4 1.2 Prerequisites ................................................................................................................................ 4 1.2.1 Literature .................................................................................................................................................. 4 1.3 Structure ...................................................................................................................................... 5 2 The Case ................................................................................................................................. 5 3 The Access Environment ........................................................................................................ 8 3.1 Configuration ............................................................................................................................ 10 3.2 SQL ............................................................................................................................................. 10 4 Creating A Database ............................................................................................................ 11 4.1 Creating Tables ......................................................................................................................... 11 4.1.1 Design .................................................................................................................................................... 11 4.1.2 DDL ....................................................................................................................................................... 18 4.1.3 Defining Other Restrictions ................................................................................................................... 20 4.2 Working With Relationships .................................................................................................... 23 4.2.1 Simple Foreign Keys ............................................................................................................................. 26 4.2.2 ISA Inheritance ...................................................................................................................................... 28 4.2.3 Composite Foreign Keys ....................................................................................................................... 31 4.2.4 Multiple Relationships Between The Same Two Tables ...................................................................... 32 4.2.5 Recursive Relationships ........................................................................................................................ 32 5 Querying A Database - Working With Data ........................................................................ 34 5.1 Preparing The Database With Data ........................................................................................ 34 5.1.1 Using SQL ............................................................................................................................................. 34 5.1.2 Using Datasheets ................................................................................................................................... 35 5.1.3 Using Forms ........................................................................................................................................... 37 5.2 Writing SQL .............................................................................................................................. 38 5.3 Reusing Queries ......................................................................................................................... 40 6 Forms .................................................................................................................................... 42 6.1 Simple Forms ............................................................................................................................. 42 6.2 Lookups ...................................................................................................................................... 50 6.3 Master-Detail Constructs ......................................................................................................... 63 6.4 Forms Based On Queries .......................................................................................................... 75 6.5 Non-Data Forms ........................................................................................................................ 80 7 Reports .................................................................................................................................. 82 7.1 Simple Reports .......................................................................................................................... 82 7.2 Reports That Combine Many Tables ...................................................................................... 83 7.3 Reports Based On Queries ....................................................................................................... 87 2 SU/DSV Introduction to MS Access 2013 October 2014 KTH/ICT/SCS v 3.0 nikos dimitrakas 7.4 Grouping And Sorting .............................................................................................................. 88 7.5 Subreports ................................................................................................................................. 93 8 Macros .................................................................................................................................. 98 9 Other Useful Tips ............................................................................................................... 103 9.1 Tip 1 - Lookups For Tables .................................................................................................... 103 9.2 Tip 2 - Viewing Subtables ....................................................................................................... 104 9.3 Tip 3 - Sorting And Filtering ................................................................................................. 107 9.4 Tip 4 - SQL Parameters .......................................................................................................... 108 9.5 Tip 5 - Nesting SELECT Statements – COUNT(DISTINCT) ............................................. 109 9.6 Tip 6 - Application Start-Up .................................................................................................. 110 9.7 Tip 7 - Concatenating Columns ............................................................................................. 111 9.8 Tip 8 - Using Forms To Find Records ................................................................................... 111 9.9 Tip 9 - Keys And Indexes ....................................................................................................... 111 9.10 Tip 10 - Multiple Subforms .................................................................................................. 112 9.11 Tip 11 - Division In Access ................................................................................................... 112 9.12 Tip 12 - Object Dependencies............................................................................................... 114 9.13 Tip 13 - Copying Objects Between Databases .................................................................... 114 9.14 Tip 14 - Handling NULL ...................................................................................................... 114 9.15 Tip 15 - Business Rules ......................................................................................................... 115 9.16 Tip 16 - Set Operators .......................................................................................................... 116 9.17 Tip 17 - Multimedia .............................................................................................................. 116 9.17.1 Storage Outside The Database .......................................................................................................... 121 9.18 Tip 18 - Compacting And Repairing A Database .............................................................. 122 9.19 Tip 19 - Linking External Data ............................................................................................ 123 9.19.1 Creating An ODBC Alias .................................................................................................................. 124 9.19.2 Linking To The MySQL Tables From Access ................................................................................. 126 9.19.3 Working With Linked Tables ............................................................................................................ 128 9.20 Tip 20 - Working With Dates And Times ........................................................................... 130 10 Other Resources ............................................................................................................... 133 10.1 Web Sites