190 likes | 270 Views
Enhancing Forms with OLE Fields, Hyperlinks, and Subforms – Project 5. Project 5 Overview. Project 5 introduces us to additional data types. We will learn how to: Create and work with date, memo, hyperlink, and OLE fields. Create and use input masks. Use the new data types in a form.
E N D
Enhancing Forms with OLE Fields, Hyperlinks, and Subforms – Project 5
Project 5 Overview Project 5 introduces us to additional data types. We will learn how to: • Create and work with date, memo, hyperlink, and OLE fields. • Create and use input masks. • Use the new data types in a form. • Build a form based on a one-to-many relationship in which several records from one of the tables displays on the screen at the same time. • Use date and memo fields in queries to answer questions.
Project 5 Perspective AJC needs to maintain additional data on trainers. • The Trainer table will change as follows: • A start date added for each trainer in the database • A memo field added for each trainer and a trainer’s picture • A trainer’s (hyperlinked) web page field added • A phone number field with an Input Mask added • A New Form created with new and old fields • Add new and old Fields to the form • Creating a Subform – Showing, and capability of scrolling through, multiple clients while viewing the related Trainer data • Capability of accessing trainer’s Web Page from form • Queries added that use Start Date and Comment fields • Note that new fields will have no effect on existing forms/reports
Special Fields (AC 260) • Often fields must be added to a database that require special data types • These data types are: Date, Memo, OLE, Hyperlink • They do not use field sizes • Date (D) – Field contains only valid dates. Valid dates … meaning • Month must be between 1 and 12 • Day must be between 1 and 31 • Cannot enter an invalid date for a particular month;for example, June 31, 2005. • Memo – the field contains text that is variable in length. Length of text stored in these fields is virtually unlimited.
Special Fields (AC 260) • OLE – The field contains objects created by other applications that support OLE as a server. • Object Linking and Embedding – a Microsoft feature that creates a special relationship between one application (i.e. MS Access) and the application that created the object. When you edit the object from the where it is embedded, Access returns to the application that created the object. • Hyperlink – Contains links to other Office documents or to Web pages.
Using the Input Mask Wizard (AC 262) Input Mask - An input mask specifies how the data is to be entered and how it will appear. • Input masks make data entry easier and control the values users can enter in a text box control. • Data could be stored with the symbols (i.e. phone number) but storing data without the symbols takes up less space. • Input Mask differs from Display Format • Display Format only displays after data has been saved • Input Mask is used for data entry • If a format also has been specified for the field, the format takes precedence over the input mask.
Entering Data Entering data using an input mask (AC 265) • The cursor should be positioned at the beginning of the field when entering data in a field that has an input mask. • Access will insert the appropriate special characters in the proper positions.
Entering Data Entering data in date fields (AC 266) • Type the date and include slashes (/) • Access 2003 automatically treats all two-digit years before 30 as 2000 through 2029. • Other dates are treated as 1930 through 1999. • For example, the date 1/2/01 will display as 1/2/2001 if the short date style is set to MM/dd/yyyy.
Entering Data Entering data in memo fields (AC 266) • Simply type the data in the field • Since only a small portion of the memo will appear on the screen … • Press Shift+F2 for a Zoom box that makes data entry easier.
Entering Data Entering data in OLE fields (AC 268) • To insert data into an OLE field … • Use Insert Object command on the OLE field’s shortcut menu. • The Insert Object command presents a list of the various types of objects that can be inserted. • Access then opens the corresponding application to create the object (if needed), or simply inserts it directly from the file. • OLE fields use a great deal of disk space. Therefore, do not save the database to floppy disk.
Entering Data Entering data in Hyperlink fields (AC 271) • To insert data into a Hyperlink field … • Use the Hyperlink command on the Hyperlink field’s shortcut menu. • Then edit the hyperlink - you can enter the Web page address for the appropriate Web page or specify a file that contains the document to which you want to link. • Now let’s open Access and the AJC Database to enter these fields and data
Advanced Form Techniques (AC 273) Referential Integrity • A validity check to avoid data inconsistency or quality problems. • A foreign key value cannot be entered in one table unless it matches a primary key in another table. • For example, with referential integrity you cannot … • Enter a Customer order in the Order table UNLESS • Customer already exists in the Customer table • Otherwise, you would end up with an orphan record
Advanced Form Techniques (AC 273) There are 3 types of relationships between entities: • One-to-one – Exactly one of the 2nd entity occurs for each instance of the 1st entity.For example, a Department Head chairs a Department. • One-to-many – One occurrence of the 1st entity can relate to many instances of the 2nd entity, but each instance of the 2nd entity can associate with only one instance of the 1st entityFor example, One department employs Many employees. • Many-to-many – One instance of the 1st entity can relate to many instances of the second entity and one instance of the 2nd entity can relate to many instances of the 1st entityFor example, Many students enroll in Many Classes. Our focus is the One-to-many relationshipbetween the Trainer and the Client tables One Trainer services Many clients
Advanced Form Techniques (AC 273) Our goal is to show and be able to scroll through multiple clients while viewing the related Trainer data. To do this, we must use a subform within a main form.___________________________________________ • Main form – form in which the subform is contained. It contains data from the one table (Trainer) • Subform – A form that is contained within another form. It contains data from the many table (Client).___________________________________________ • In Access, Form Wizard easily creates this form. • Some DBMS packages, require a custom program to produce the same result.
Modifying the Subform Design (AC 278) Once the main form and subform have been created, you can modify these forms in Design view: • Open the subform in Design view • Convert to Datasheet view to resize each column
Changing the Picture Size Mode (AC 287) Size mode – Determines the portion of a picture that appears as well as the way it appears (Use Property Sheet to change). Possible size modes are: • Clip – Displays portion of picture that fits in space allocated to it. • Stretch – Expands/shrinks picture to fit precise space allocated. Not good for photographs – distort. • Zoom – Best for fitting picture to allocated space without changing look of picture (best for photos). • Entire picture will appear, and be proportioned correctly. Some white space may be visible above/ to right of picture.
Changing Tab Stops (AC 293) • Users press TAB to move through fields on a form • Access automatically determines the order in which these fields are encountered. • Tab Stop property:Determines whether tab key moves through or bypasses a control • You may want to bypass a control on the form(such as the Picture control). • Change the Tab Stop property to “No” to bypass • Tab Order command on View Menu:Allows you to change the order in which fields are encountered when tabbing through a form • You can manually change the order in which fields are encountered
Viewing Object Dependencies (AC 299) • In Access, you can view information on dependencies between database objects. • The ability to view Object Dependencies is a new feature in Access 2003. • The Object Dependencies command allows you to see the dependencies for any object or to see what objects depend on that object. • Viewing a list of objects that use a specific object helps in the maintenance of a database and avoids errors when changes are made to the objects involved in the dependency.
Enhancing Forms with OLE Fields, Hyperlinks, and Subforms – Project 5 Any Questions?