You are on page 1of 11

PRACTICAL NO.

DATE

: :

7 24TH SEPTEMBER, 2012

Microsoft Access
To make Table, Queries, Forms & Reports

About Microsoft Access 2007


Microsoft Access, also known as Microsoft Office Access, is a database management system from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools. It is a member of the Microsoft Office suite of applications, included in the Professional and higher editions or sold separately. On May 12, 2010, the current version of Microsoft Access 2010 was released by Microsoft in Office 2010; Microsoft Office Access 2007 was the prior version. MS Access stores data in its own format based on the Access Jet Database Engine. It can also import or link directly to data stored in other applications and databases. Software developers and data architects can use Microsoft Access to develop application software, and "power users" can use it to build software applications. Like other Office applications, Access is supported by Visual Basic for Applications, an object-oriented programming language that can reference a variety of objects including DAO (Data Access Objects), ActiveX Data Objects, and many other ActiveX components. Visual objects used in forms and reports expose their methods and properties in the VBA programming environment, and VBA code modules may declare and call Windows operating-system functions.

T a ble s
When you create a database you store your data in tables subject-based lists of rows and columns. Columns are also called fields, which are the information items you want to track. You define a table in terms of the fields you want to track for that subject.

Add fields to a table in Datasheet view


You store the information items you want to track in fields (also called columns). For example, in a Contacts table you might create fields for LastName, FirstName, Telephone Number and Address, among others. For a Products table you might create Product Name, Product ID and Price. It is important that you choose fields carefully. For example, it's usually a bad idea to create a field to store a calculated value. You can usually have Office Access 2007 calculate the value when needed instead. When choosing fields, try to store information in its smallest useful parts. For instance, instead of a FullName, consider storing a LastName and a FirstName. Generally speaking, if you need to report, sort, search or calculate on an item of information, put it in a column by itself. For more information about designing a database and choosing fields, see the article Database design basics. A field has certain defining characteristics. For example, every field has a Name that uniquely identifies the field within a table. A field also has a data type that's chosen to match the information to be stored. The data type determines the values that can be stored and the operations that can be performed, as well as how much storage space to set aside for each value. Every field also has an associated group of settings called properties that define the appearance or behavior characteristics of the field. For example, the Format property defines a field's display layout that is, how it should appear when displayed. When you create a new table, the table opens in Datasheet view. You can immediately add a field by typing some information in the Add New Field column.

Add a new field to an existing table


1. 2. 3. 4. Click the Microsoft Office Button , and then click Open.

In Open dialog box, select and open the database. In the Navigation Pane, double-click one of the available tables to open it. Type your data in the cell below the Add New Field column header.

Add a new field to a new table


1. 2. 3. Click the Microsoft Office Button , and then click Open.

In Open dialog box, select and open the database. On the Create tab, in the Tables group, click Table.

Access inserts a new table in the database and opens it in Datasheet view. 4. Type your data in the cell below the Add New Field column header.

When you enter data in the new column, Office Access 2007 uses the information you type to recognize the appropriate data type for the field. For example, if you type a date in the column, such as 1/1/2006, Office Access 2007 sees the information you entered, recognizes it as a date, and sets the data type for the field to Date/Time. If Access doesn't have enough information from what you enter to guess the data type, the data type is set to Text.

Q ue r ie s
Queries are useful for working with just those fields from a table that pertain to the task at hand. When you want to further restrict the data that you work with, based on the value contained in a field, you can use criteria in your query. Criteria are rules that you include in the design of a query these rules specify values or patterns that you want the fields to match or contain to be returned by the query. When you want a query to prompt you for a value or pattern every time you run it, you can create a parameter query. You can also use parameters with a report to prompt you for criteria when you run the report. You can use forms to enhance the collection and passing of query and report parameters in the following ways: By allowing you to use data-type-specific controls By enabling the persistence of parameter values By allowing the use of combo box controls (so you can pick a value from a list, rather than typing it) By allowing you to use other controls that are available in forms

Make table queries


A make table query retrieves data from one or more tables, and then loads the result set into a new table. That new table can reside in the database that you have open, or you can create it in another database. The process of creating a make table query follows these broad steps: Enable the database, if it is not signed or if it does not reside in a trusted location. You cannot run action queries (append, update, and make table queries) otherwise. In query Design view, create a select query and then modify that query until it returns the records you want. You can select data from more than one table and, in a real sense, you can de-normalize your data. For example, you can place customer, shipper, and supplier data in a single table, something you would not do in a production database with properly normalized tables. You can also use criteria in the query to further customize or narrow your result set. For more information about normalizing your data, see the article Database design basics. Convert the select query to a make table query, choose a location for the new table, and then run the query to create the table.

Create a make table query


You create a make table query by first creating a select query, and then converting it to a make table query. Your select query can use calculated fields and expressions to help return the data that you need. The following steps explain how to create and convert the query. If you already have a select query that fits your needs, you can skip ahead to the steps for converting the select query and running the make table query.

Enable the database


NOTE Follow these steps only when your database does not reside in a trusted location or is not signed. Access displays the Message Bar whenever you open an untrusted or unsigned database.

1. 2.

On the Message Bar, click Options. In the Microsoft Office Security Options dialog box, click Enable this content, and then click OK.

If you don't see the Message Bar


On the Database Tools tab, in the Show/Hide group, click Message Bar.

Create the select query


NOTE

If you already have a select query that produces the data that you need, go to the next steps.

1.

On the Create tab, in the Other group, click Query Design.

2.

In the Show Table dialog box, double-click the tables from which you want to retrieve data. Each table appears as a window in the upper section of the query designer. Click Close when have finished adding the tables. In each table, double-click the field or fields that you want to use in your query. Each field appears in a blank cell in the Field row of the design grid. This figure shows the design grid with several table fields added.

3.

4. 5. 6. Optionally, add any expressions to the Field row. Optionally, add any criteria to the Criteria row of the design grid.

7. 8.

Click Run

to run the query and display the results in a datasheet.

Optionally, change your fields, expressions, or criteria and rerun the query until it returns the data that you want to place in your new table.

Convert the select query


1. Open your select query in Design view, or switch to Design view. Access provides several ways to do this:


2.

If you have the query open in a datasheet, right-click the document tab for your query and click Design View. If the query is closed, in the Navigation Pane, right-click the query and click Design View on the shortcut menu. On the Design tab, in the Query Type group, click Make Table. The Make Table dialog box appears.

3.

In the Table Name box, enter a name for the new table. -orClick the down-arrow and select an existing table name.

4.

Do one of the following:

Place the new table in the current database 1. 2. If it isn't already selected, click Current Database, and then click OK. Click Run , and then click Yes to confirm the operation.

NOTE If you are replacing an existing table, Access first deletes that table and asks you to confirm the deletion. Click Yes, and then click Yes again to create the new table.

Place the new table in another database 1. 2. Click Another Database. In the File Name box, enter the location and file name of the other database. -orClick Browse, use the new Make Table dialog box to locate the other database, and click OK. 3. 4. Click OK to close the first Make Table dialog box. Click Run , and then click Yes to confirm the operation.

NOTE If you replace an existing table, Access first deletes that table and asks you to confirm the deletion. Click Yes, and then click Yes again to create the new table.

F o rm
A form is a database object that you can use to enter, edit, or display data from a table or a query. You can use forms to control access to data, such as which fields or rows of data are displayed. For example, certain users might need to see only several fields in a table with many fields. Providing those users with a form that contains just those fields makes it easier for them to use the database. You can also add buttons and other functionality to a form to automate frequently performed actions. Think of forms as windows through which people see and reach your database. An effective form speeds the use of your database, because people don't have to search for what they need. A visually attractive form makes working with the database more pleasant and more efficient, and it can also help prevent incorrect data from being entered. Microsoft Office Access 2007 gives you new tools to help you create forms quickly, and provides new form types and features that improve the usability of your database.

Create a form by using the Form tool


You can use the Form tool to create a form with a single mouse-click. When you use this tool, all the fields from the underlying data source are placed on the form. You can begin using the new form immediately, or you can modify it in Layout view or Design view to better suit your needs.

Use the Form tool to create a new form


1. 2. In the Navigation Pane, click the table or query that contains the data you want to see on your form. On the Create tab, in the Forms group, click Form.

Access creates the form and displays it in Layout view. In Layout view, you can make design changes to the form while it is displaying data. For example, you can adjust the size of the text boxes to fit the data, if necessary. For more information about form views, see the Understand Layout view and Design view section. If Access finds a single table that has a one-to-many relationship with the table or query that you used to create the form, Access adds a datasheet to the form that is based on the related table or query. For example, if you create a simple form that is based on the Employees table, and there is a one-to-many relationship defined between the Employees table and Orders table, the datasheet displays all the records in the Orders table that pertain to the current Employee record. You can delete the datasheet from the form if you decide you do not need it. If there is more than one table with a one-to-many relationship to the table that you used to create the form, Access does not add any datasheets to the form.

Create a form by using the Form Wizard


To be more selective about what fields appear on your form, you can use the Form Wizard instead of the various form-building tools previously mentioned. You can also define how the data is grouped and sorted, and you can use fields from more than one table or query, provided that you specified the relationships between the tables and queries beforehand. For more information about creating relationships, see the links in the See Also section of this article.

1. 2.

On the Create tab, in the Forms group, click More Forms, and then click Form Wizard. Follow the directions on the pages of the Form Wizard.

NOTE If you want to include fields from multiple tables and queries on your form, do not click Next or Finish after you select the fields from the first table or query on the first page of the Form Wizard. Instead, repeat the steps to select a table or query, and click any additional fields that you want to include on the form. Then click Next or Finish to continue.

3.

On the last page of the wizard, click Finish.

R e po r t
A report consists of information that is pulled from tables or queries, as well as information that is stored with the report design, such as labels, headings, and graphics. The tables or queries that provide the underlying data are also known as the report's record source. If the fields that you want to include all exist in a single table, use that table as the record source. If the fields are contained in more than one table, you need to use one or more queries as the record source. Those queries may already exist in your database, or you may need to create new queries specifically to fit the needs of your report.

Create a report by using the Report tool


The Report tool provides the fastest way for you to create a report, because it generates a report immediately without prompting you for information. The report displays all the fields from the underlying table or query. The Report tool may not create the final, polished product that you ultimately want, but it is quite useful as a means to quickly look at the underlying data. You can then save the report and modify it in Layout view or Design view so that it better serves your purposes. 1. 2. In the Navigation Pane, click the table or query on which you want to base the report. On the Create tab, in the Reports group, click Report. Access builds the report and displays it in Layout view. 3. For more about viewing and printing your report, see the section View, print, or send your report as an email message.

After viewing the report, you can save it and then close both the report and the underlying table or query that you used as a record source. The next time that you open the report, Access will display the most recent data from your record source.

Table

Form

Contact
Sr. No First Name
1 Pankaj 2 Pankaj 3 Palak 4 Nishu 5 Parshant 6 Sandeep 7 Swati 8 Pooja 9 Shivani 10 Radhika

Last Name
Gill Singh Gupta Ahlawat Singla Rawat Talwar Badhal Garg Singhal

E-Mail
pankajsinghgill@gmail.com pankajsinghgill@hotmail.com palak_gupta@gmail.com nishu_2012@gmail.com parshant_inbos2011@hotmail.com sandy_in@yahoo.com talwar.swati@gmail.com puja_123678@gmail.com shivi_me@rediff.com radhika.me@live.in

Phone No. Address


9671908002 Sector-4(Rohtak) 9991533553 Sector-4(Rohtak) 9991557852 Hisar 8745852145 VPO Bohar 7206666710 Arya Nagar 9813254210 Bhiwani 9034270227 Sector-1(Rohtak) 9034258124 Sector-3(Rohtak) 8950248585 VPO Julana 8724575124 Janta Colony

Monday, October 15, 2012

Page 1 of 1

You might also like