INTRODUCING Access R. Kumar
R/DBMS.. Database : A database is logically organised and structured collection of integrated data stored together without redundancy to serve multiple applications and diverse and changing information requirements. Data Base Management System : A DBMS is a software tool that provides facilities for the management of data. DDL defining the contents and form of the database to the DBMS DML programmes to specify the update and retrieval operations to be performed by DBMS. Data Dictionary a repository of the data base definition
Terms.. File : A file is a collection of bytes stored as an individual entity. Entity : An entity is anything about which information can be stored. Attribute : An attribute is a characteristic of interest about an entity. Instance : An instance of the entity is represented by a set of specific values for each attributes. Car Manufacture,Model,Price,Engine Capacity, Fuel Consumption Hyundai Mots.,Accent,615000 Rs.,1500cc,12km/l Ford Mots.,Ikon,475000 Rs.,1300cc,9km/l - Attributes of two instances of the entity car.
Terms contd.. Data item : Each attribute of an entity is represented in storage by a data item. A data item is the elementary unit in data storage. Record : The data representation in storage of each instance of an entity is called a record. File : A collection of logically related records is a file. Types - Master, Transaction and Report Master Relatively permanent information about entities and used as a source of reference data for processing. Transaction Collection of records describing activities or transactions by organisation and used to update the details in the master file. Report Created by extracting data to prepare a report.
Operations on file.. Create Open Insert Delete Read Next/Previous/First/Last Modify Find Attributes Close
Access Database management system is a powerful tool to handle business and personal information. Main features of Access are : Main features of Access are : - Tables : fields that contains data of many different types - Queries : extracts specific data from multiple tables. - Forms : informative/interactive design - Reports : distributing printed information from tables - Macros : actions that work together for particular task in response to an event
GUIs Title Bar Menu Bar Database Toolbar Task Pan - Getting started New file Objects Database Window Status Bar
Field data types available in Microsoft Access Data type Use for Size Text Text or combinations of text and numbers, such as addresses. Also numbers that do not require calculations, such as phone numbers, part numbers, or postal codes. Up to 255 characters. Microsoft Access only stores the characters entered in a field; it does not store space characters for unused positions in a Text field. To control the maximum number of characters that can be entered, set the FieldSize property. Memo Lengthy text and numbers, such as notes or descriptions. Up to 64,000 characters. Number Numeric data to be used for mathematical calculations, except calculations involving money (use Currency type). Set the FieldSize property to define the specific Number type. 1, 2, 4, or 8 bytes. 16 bytes for Replication ID (GUID) only.
Date/Time Dates and times. For more information on defining a Date/Time field, click. 8 bytes. Currency Currency values. Use the Currency data type to prevent rounding off during calculations. Accurate to 15 digits to the left of the decimal point and 4 digits to the right. 8 bytes. AutoNumber Unique sequential (incrementing by 1) or random numbers automatically inserted when a record is added. 4 bytes. 16 bytes for Replication ID (GUID) only.
Yes/No OLE Object Hyperlink Fields that will contain only one of two values, such as Yes/No, True/False, On/Off. For more information on defining a Yes/No field, click. Objects (such as Microsoft Word documents, Microsoft Excel spreadsheets, pictures, sounds, or other binary data), created in other programs using the OLE protocol, that can be linked to or embedded in a Microsoft Access table. You must use a bound object frame in a form or report to display the OLE object. For more information on defining an OLE Object field, click. Field that will store hyperlinks. A hyperlink can be a UNC path or a URL. For more information on defining a Hyperlink field, click. 1 bit. Up to 1 gigabyte (limited by disk space). Up to 64,000 characters. Lookup Wizard Creates a field that allows you to choose a value from another table or from a list of values using a combo box. Choosing this option in the data type list starts a wizard to define this for you. For more information on defining a Lookup field, click. The same size as the primary key field that is also the Lookup field; typically 4 bytes.
Number, Date/Time, Currency, and Yes/No data Number, Date/Time, Currency, and Yes/No data types provide predefined display formats. Set the Format property to choose from the formats available for each data type. We can also create a custom display format for all data types except the OLE Object data type.
Field Properties RK/XISS/06
Database GUI
Database Window
Table Structure DB
Data Structure Windows Create Table in Design View (New -> > Design View)
Creation of Table from Scratch in Design View
RK/XISS/06
RK/XISS/06
RK/XISS/06
RK/XISS/06 Switching Views Design View Displays the view, which allows you to enter fields, data-types and descriptions into database table. Datasheet View Displays the view, which allows to enter raw data into database table. Datasheet View / Open View..
Create Table by Using Wizard RK/XISS/06
Create Table by Entering Data RK/XISS/06
Structure of Table Entering Data
Insert Object
Insert Hyperlink
OLE Object & Hyperlink in Form
Form Wizard
Form - Data-entry form to enter data into a table. - Switchboard form to open other forms/reports. - Custom dialog box to accept user input and then carry out an action based on that input. How To Create? Create a form by using AutoForm. With AutoForm, you select one record source and either columnar, tabular, or datasheet layout; AutoForm creates a form that uses all the fields from the record source you selected and all the fields from its related record sources. Create a form with a wizard. The wizard asks you detailed questions about the record sources, fields, layout, and format you want and creates a form based on your answers. Create a form on my own Create a form based on more than one table
Form Components - One can increase the effectiveness of a form by adding one or more sections. All forms have a detail section, but a form can also include form header, page header, page footer, and form footer sections. - Control, a graphical object, such as a text box, check box, command button, or rectangle, that one can place on a form, report, or data access page in Design view. A control can display data, perform an action, or make the form, report, or data access page easier to use/read. - Steps to create in Design view: Database window Forms New Design view Choose the table/query where the object s data commes from: e.g. EMPLOYEE OK Components: Form windows, Field list, Control box, Property sheet. Field list: Use to add bound controls to the form/report by dragging the field from the field list to a form/report section. Property sheet: Use to display and modify the properties of tables, queries, forms reports, and data access pages. Tables/Queries: In Design view, Display & Modify, properties of fields.
Query Select queries Crosstab queries Action queries (Make-table, Delete, Update, Append Queries) Select queries It retrieves data from one or more tables and displays the results in a datasheet where you can update the records (with some restrictions). Crosstab queries A crosstab query displays summarized values (sums, counts, and averages) from one field in a table and groups them by one set of facts listed down the left side of the datasheet and another set of facts listed across the top of the datasheet. Action queries An action query is a query that makes changes to many records in just one operation.
Make-table query Creates a new table from all or part of the data in one or more tables. Maketable queries are helpful for: Creating a table to export to other Microsoft Access databases. Creating data access pages that display data from a specified point in time. Making a backup copy of a table. Creating a history table that contains old records. Improving performance of forms, reports, and data access pages based on multiple-table queries or SQL statements. Update query Makes global changes to a group of records in one or more tables. Append query Adds a group of records from one or more tables to the end of one or more tables. Delete query Deletes a group of records from one or more tables.
Select queries SELECT EMPLOYEE.DA, EMPLOYEE.F_NAME, EMPLOYEE.S_NAME, EMPLOYEE.BASIC FROM EMPLOYEE; Make-table query SELECT EMPLOYEE.ENP_ID, EMPLOYEE.F_NAME, EMPLOYEE.S_NAME, EMPLOYEE.GENDER, EMPLOYEE.NET_SAL INTO NEW_EMPLOYEE FROM EMPLOYEE; (New Table Name : NEW_EMPLOYEE) Update query UPDATE EMPLOYEE SET EMPLOYEE.DA = [EMPLOYEE]![BASIC]*50/100 UPDATE EMPLOYEE SET EMPLOYEE.ITPAYEE = True, EMPLOYEE.IT = [basic]*1/100 WHERE (((EMPLOYEE.BASIC)>20000));
Delete query DELETE OLD_EMPLOYEE.ENP_ID, OLD_EMPLOYEE.F_NAME, OLD_EMPLOYEE.S_NAME, OLD_EMPLOYEE.GENDER, OLD_EMPLOYEE.NET_SAL FROM OLD_EMPLOYEE WHERE (((OLD_EMPLOYEE.GENDER)=True)); Append query INSERT INTO OLD_EMPLOYEE ( ENP_ID, F_NAME, S_NAME, GENDER, NET_SAL ) SELECT NEW_EMPLOYEE.ENP_ID, NEW_EMPLOYEE.F_NAME, NEW_EMPLOYEE.S_NAME, NEW_EMPLOYEE.GENDER, NEW_EMPLOYEE.NET_SAL FROM NEW_EMPLOYEE;
Query
Select Query : Relationship
Running Query : Salary Slip
Relationship in Data Sheet View
Update Query
Expression Builder
Select Query
Field Properties : InputMask Symbol Items Entry Reqd. 0 (0-9), no +/-, Blanks as 0s 9 (0-9), no +/-, Blanks as spaces x # (0-9), +/-, Blanks as spaces x L (A-Z)? (A-Z) x A (A-Z), (0-9) a (A-Z), (0-9) x & Any char. or space C Any char. or space x > Converts letter to uppercase - < Converts letter to lowercase - \ Treats the next character as a literal - Password Stores as chars. but displays as *s -
InputMask contd. InputMask 00000-99999 (999) AAA-AAAA >L<?????????? >LL0000-000 >L0l 0L0 #999 Description Uses 0s to represent reqd. items, 9s are optional Allows letters/digits, area code (first three) is optional Converts reqd. initial letter to uppercase, optional chars. to lowercase Converts the two reqd. letters to uppercase, followed by 7 reqd. digits Converts all letters to uppercase, reqd. digits Allows sign as initial char, remaining digits are optional Valid Items 98351-98351-15389 (651) 555-TALK Payal Abhishek IM2006-001 PM2005-100 N0C 1M0-57 2006
Format The Format property uses different settings for different data types. For information about settings for a specific data type, see one of the following topics: Date/Time Data Type Number and Currency Data Types Text and Memo Data Types Yes/No Data Type Symbols in custom formats for any data type : Symbol Meaning (space) Display spaces as literal characters. "ABC" Display anything inside quotation marks as literal characters.! Force left alignment instead of right alignment. * Fill available space with the next character. \ Display the next character as a literal character. You can also display literal characters by placing quotation marks around them. [color] Display the formatted data in the color specified between the brackets. Available colors: Black, Blue, Green, Cyan, Red, Magenta, Yellow, White.
Format Property Date/Time Data Type Setting Description General Date (Default) If the value is a date only, no time is displayed; if the value is a time only, no date is displayed. This setting is a combination of the Short Date and Long Time settings. Examples: 4/3/93, 05:34:00 PM, and 4/3/93 05:34:00 PM. Long Date Same as the Long Date setting in the Regional Settings Properties dialog box in Windows Control Panel. Example: Saturday, April 3, 1993. Medium Date Example: 3-Apr-93. Short Date Same as the Short Date setting in the Regional Settings Properties dialog box in Windows Control Panel. Example: 4/3/93. Warning The Short Date setting assumes that dates between 1/1/00 and 12/31/29 are twenty-first century dates (that is, the years are assumed to be 2000 to 2029). Dates between 1/1/30 and 12/31/99 are assumed to be twentieth century dates (that is, the years are assumed to be 1930 to 1999). Long Time Same as the setting on the Time tab in the Regional Settings Properties dialog box in Windows Control Panel. Example: 5:34:23 PM. Medium Time Example: 5:34 PM. Short Time Example: 17:34.
Format Property Number and Currency Data Types Setting Data Display General Number 3456.789 3456.789 $213.21 Currency 3456.789 3456.789 Fixed 3456.789 3456.789 3.56645 3456.789 3456.789 $213.21 $3,456.79 ($3,456.79) 3456.79 3456.79 3.57 Standard 3456.789 3,456.79 Percent 3 0.45 Scientific 3456.789 3456.789 300% 45% 3.46E+03 3.46E+03
Custom Number Formats Custom number formats can have one to four sections with semicolons (;) as the list separator. Each section contains the format specification for a different type of number. Section First Second Third Fourth Description The format for positive numbers. The format for negative numbers. The format for zero values. The format for Null values. Symbol Description. (period) Decimal separator. Separators are set by double-clicking Regional Settings in Windows Control Panel., (comma) Thousand separator. 0 Digit placeholder. Display a digit or 0. # Digit placeholder. Display a digit or nothing. $ Display the literal character "$". $#,##0.00[Green];($#,##0.00)[Red];"Zero";"Null"
Format Property Text and Memo Data Types Custom formats for Text and Memo fields can have up to two sections. Each section contains the format specification for different data in a field. One can create custom text and memo formats by using the following symbols: Section Description First Second Symbol @ & Format for fields with text. Format for fields with zero-length strings and Null values. Description Text character (either a character or a space) is required. Text character is not required. < Force all characters to lowercase. > Force all characters to uppercase.
Format Property Text and Memo Data Types Example In a text box control in which we require to have the word "None" to appear when there is no string in the field, one can enter the custom format @;"None" as the control's Format property setting. Setting Data Display @@@-@@-@@@@ 465043799 465-04-3799 @@@@@@@@@ 465-04-3799 465043799 465-04-3799 465043799 > davolio DAVOLIO Davolio < davolio DAVOLIO Davolio DAVOLIO DAVOLIO DAVOLIO davolio davolio davolio @;"Unknown" Null value Unknown Zero-length string Any text Unknown Same text as entered is displayed
Format Property Yes/No Data Type Format property to the Yes/No, True/False, or On/Off predefined formats or to a custom format for the Yes/No data type. Yes, True, and On are equivalent, as are No, False, and Off. A check box control as the default control for the Yes/No data type. Custom Formats The Yes/No data type can use custom formats containing up to three sections. Section First Second Third Description This section has no effect on the Yes/No data type. However, a semicolon (;) is required as a placeholder. The text to display in place of Yes, True, or On values. The text to display in place of No, False, or Off values. Format Property Yes/No Data Type Example The following example shows a custom yes/no format for a text box control. The control displays the word "Always" in blue text for Yes, True, or On, and the word "Never" in red text for No, False, or Off. ;"Always"[Blue];"Never"[Red]
Report A report is an effective way to present the data in a printed format (hard copy). Because of the control over the size and appearance of everything on a report, one can display the information the way user wants to see it. Create a report by using AutoReport. With AutoReport, you select one record source and either columnar or tabular layout; AutoReport uses all the fields from the record source and applies the last autoformat you used to the report. Create a report with a wizard. The wizard asks you detailed questions about the record sources, fields, layout, and format you want and creates a report based on your answers. Create a report on my own (in design view) Database window Reports New Design view Choose the table/query where the object s data comes from: e.g. EMPLOYEE OK Components: Report windows, Field list, Control box, Property sheet. Field list: Use to add bound controls to the form/report by dragging the field from the field list to a form/report section. Property sheet: Use to display and modify the properties of tables, queries, forms reports, and data access pages.
the report in Design view
A P P E A R A N C E
F I E L D L I S T
C O N T R O L S
S O R T I N G S
P R O P E R T I E S
Expression Any combination of operators, constants, literals, functions, and names of fields (columns), controls, and properties that evaluate to a single value. Expressions as: - settings for many properties and action arguments - to define calculated controls in forms, reports, and data access pages - to set criteria (search conditions)or define calculated fields in queries; - to set conditions in macros