Microsoft Access Intro Class 2 Designing Databases and Tables
2 Naming Conventions Clearly defines the type and purpose of each object A consistent naming convention will Bring order to your database Aid in documentation Make it easier to understand the database (ie: choosing an object using the report wizard, reading a report generated by the Database Documenter) Common naming conventions (choose one and then be consistent) Hungarian Reddick ( Leszynski – Popular
3 Naming Conventions (cont’d) Access Requirements Object names up to 64 characters long Can include any combination of letters, numbers, spaces, and special characters, except a period (.), and exclamation point (!), and accent grave and brackets ([]) Cannot begin with a space Cannot include control characters (ASCII values 0 through 31) Table, view, or stored procedure names cannot include a double quotation mark (“) Table and Query names must be unique in the database. Naming any other objects with the same name is NOT recommended
4 Creating a Table in Design View In Database window, double-click the option to create a new table using Design View Type desired field names in appropriate column Choose data type for each field Type description for each field (optional) Mark primary key (right-click desired field) Set field properties, if desired Save table
5 Data Types Data TypeDescription TextIncludes any characters up to a maximum of 255 characters (determined by field size). If the data includes a mix of numbers and any amount of letters, choose Text. (The default data type is Text). MemoUse this data types when Text is not large enough. Like Text, this data type can also have letters and umbers, but can be much larger – up to a little over 64,000 characters. NumberIncludes various forms of numerical data that can be used in calculations. Date/TimeDate and time entries in formats showing date, time, or both. CurrencyUse for currency values with up to fours digits after the decimal place. This data type is more accurate for large numbers than the Number data type, but generally takes up more space. AutoNumberUsually this is used to create an identification number for each record. The value for each record increases by one. Yes/NoOnly two possible values can be in this field. Options include Yes/No, True/False, On/Off. The default style shows a check box with a checkmark on for Yes, or a blank for No. OLE ObjectThis data type allows you to place another file type into your record. Within the field you could insert a picture (a company logo, for example), a Word document (employee resume), or an Excel spreadsheet (client summary chart). HyperlinkThis allows you to insert a Web address such as which will launch when you click it in Datasheet view or on a form. You could also type a path and file name to a file on your hard drive (C:\docs\myres.doc) or a network drive. Lookup WizardCreates a lookup column, which creates a list of values from which to choose when entering data.
6 Field Properties Field Size Format New Value (new in Access 2000) Precision (new in Access 2000) Scale Decimal Place Input Mask Caption Default Value Required Allow Zero Length Indexed Unicode Compression (New in Access 2000 – stores characters in two bytes mainly to accommodate language fonts)
7 Field Properties Field Size for Text data types determines the maximum number of characters you can type. For Number data types, the Field Size property can be used to determine how large the number can be and if you can have decimal places. Number TypeDescription ByteStores numbers from 0 to 255 (no fractions). Long Integer(Default) Stores numbers from –2,147,483,648 to 2,147,483,647 (no fractions). IntegerStores numbers from –32,768 to 32,767 (no fractions). SingleStores numbers from – E38 to – E–45 for negative values and from E–45 to E38 for positive values. DoubleStores numbers from – E308 to – E–324 for negative values and from E308 to E–324 for positive values.
8 Field Properties (cont’d) FormatUsed especially for Date/Time data types – how you want the values displayed. You can also type codes in the Format property box. For example, type m/d/yyyy for a date type to display 1/1/2000. CaptionThis will appear at the top of the column in Datasheet view. Captions will automatically carry through to new forms and reports instead of the field name. Here, you can include spaces, and other punctuation marks not normally allowed in the field name. Default ValueThis will appear in new records entered in the table. Input MaskA template to validate how each character is entered into the field. Validation RuleAllows you to verify data as the user enters it into the table. Validation TextAppears in a dialog box when a Validation Rule is broken. RequiredThe user has to fill in this field before going to another record. Allow Zero Length You can use the AllowZeroLength property to specify whether a zero-length string (" ") is a valid entry in a table field. Note: The AllowZeroLength property applies only to Text, Memo, and Hyperlink table fields. IndexedMakes searches and sorts on this field go quicker.
9 Indexes Index A separate hidden table that consists of pointers to records or a group of records Automatically set on primary keys Makes sorting and searching more efficient Maximum of 32 per table Normally index any field you plan to sort on or search by frequently Can be added at any point in the development of the database to improve performance
10 Formatting Tables When in Doubt, Right-Click Insert/Delete Fields or Records Hide/Unhide, Freeze/Unfreeze Right-click the field name or the record selector and choose the desired option from the pop-up menu Change column width/row height Position mouse pointer on line between field names or rows and drag or double-click
11 Formatting Tables (cont’d) Move/Rearrange Fields Click once on field name, then drag field name until a black line is visible and drag to new position Formatting Fields Font and style changes made to a range of data will affect all data in the ENTIRE table Remember, tables are meant to store the RAW data – to make data pretty, put it in a report!
12 This work is licensed under a Creative Commons Attribution- ShareAlike 2.5 License.Creative Commons Attribution- ShareAlike 2.5 License