Sie sind auf Seite 1von 29

Database

A database is an organized collection of data for one or more purposes, usually in digital form. The data are typically organized to model relevant aspects of reality (for example, the availability of rooms in hotels), in a way that supports processes requiring this information (for example, finding a hotel with vacancies). The term "database" refers both to the way its users view it, and to the logical and physical materialization of its data, content, in files, computer memory, and computer data storage. This definition is very general, and is independent of the technology used. However, not every collection of data is a database; the term database implies that the data is managed to some level of quality (measured in terms of accuracy, availability, usability, and resilience) and this in turn often implies the use of a general-purpose Database management system (DBMS). A generalpurpose DBMS is typically a complex software system that meets many usage requirements, and the databases that it maintains are often large and complex. The utilization of databases is now spread to such a wide degree that virtually every technology and product relies on databases and dbmss for its development and commercialization, or even may have such embedded in it. Also, organizations and companies, from small to large, heavily depend on databases for their operations.

The term database is correctly applied to the data and their containing data structures, and not to the DBMS which is a software system used to manage the data. The structure of a database is generally too complex to be handled without its DBMS, and any attempt to do otherwise is very likely to result in database corruption. Dbmss are packaged as computer software products: well-known and highly utilized products include the Oracle DBMS, Access and SQL Server from Microsoft, DB2 from IBM and the Open source DBMS mysql. Each such DBMS product currently supports

many thousands of databases all over the world. The stored data in a database is not generally portable across different DBMS, but different dbmss can inter-operate to some degree (while each DBMS type controls a database of its own database type) to support together a single application using standards like SQL(Structured Query Language)and ODBC(Open Database Connectivity). A successful general-purpose DBMS is designed in such a way that it can satisfy as many different applications and application designers and builders as possible. A DBMS also needs to provide effective run-time execution to properly support (e.g., in terms of performance, availability, and security) as many end-users (the database's application users) as needed. Sometimes the combination of a database and its respective DBMS is referred to as a Database system (DBS).

A DBMS is a set of software programs that controls the system organization, storage, management, and retrieval of data in database. Dbmss are categorized according to their data structures or types. The DBMS accepts requests for data from an application program and instructs the operating system to transfer the appropriate data. The queries and responses must be submitted and received according to a format that conforms to one or more applicable protocols. When a DBMS is used, information can be changed more easily as the organization's information requirements change. New categories of data can be added to the database without disruption to the existing system. A DBMS allows different user application programs to concurrently access the same database. Dbmss may use a variety of database models, such as the relational model or object model, to conveniently describe and support applications. It typically supports query languages, which are in fact high-level programming languages, dedicated database languages that considerably simplify writing database application programs. Database languages also simplify the database organization as well as retrieving and presenting information from it. A DBMS provides facilities for controlling data access, enforcing data integrity,

managing control, recovering the database after failures and restoring it from backup files, as well as maintaining database security.

A Basic introduction to Microsoft Access


Ms. Access is a database management tool that enables one to have good command of data collected. The programme enables one to retrieve, sort, summarize and report results speedily and effectively. It can combine data from various files through creating relationships, And can make data entry more efficient and accurate. Microsoft Access (MS Access) enables one to manage all important information from a single database file. Within the file, one can use: Tables: - Tables are the data storage facilities in Ms Access. Each table contains rows called records and columns called fields. Queries to find and retrieve specific data of interest. Forms to view, add, and update data in tables. Reports to analyze or print data in a specific layout. Data access pages to view or update, the data. In MS Access, data is stored once in one table, but can be viewed from multiple locations. When the data is updated in a Table, Query or Form, it is automatically updated everywhere it appears.

Table:Tables are the data storage facilities in Ms Access. Each table contains rows called records and columns called fields.

A record is a collection of facts about a particular animal or event. Each record in a table should be unique. To distinguish one record from another, tables can contain a primary key field. A field is a single kind of fact that may apply to each animal or event. For example, date of birth is a field in a table on animal information. The fields in a database have settings that determine the -type of data they can store, -how the data is displayed, - what can be done with the data. For example, field settings can ensure that birth dates are entered with two numbers for the month, two numbers for the day, four numbers for the year, and slashes in between: 01/04/2006. One important setting for fields is the data type, which could be a number, text, currency, and date/time.

Data types in Microsoft Access


Text:Use for text or combinations of text and numbers, such as addresses, or for numbers that do not require calculations, such as phone numbers, part numbers, or postal codes. It can store up to 255 characters. The Field Size property controls the maximum number of characters that can be entered.

Memo:Use for lengthy text and numbers, such as notes or descriptions. It can store up to 65,536 characters.

Number:Use for data to be included in mathematical calculations, except calculations involving money (use Currency type). It can store 1, 2, 4, or 8 bytes; stores 16 bytes for Replication ID (GUID). The Field Size property defines the specific Number type.

Date/Time:Use for dates and times. It can store 8 bytes.

Currency:Use for currency values and to prevent rounding off during calculations. It can store 8 bytes.

Autonumber:Use for unique sequential (incrementing by 1) or random numbers that are automatically inserted when a record is added. It can store 4 bytes; stores 16 bytes for Replication ID (GUID).

Yes/No:Use for data that can be only one of two possible values, such as Yes/No, True/False, On/Off. Null values are not allowed. It can store 1 bit.

OLE Object:Use for OLE objects (such as Microsoft Word documents, Microsoft Excel spreadsheets, pictures, sounds, or other binary data) that were created in other programs using the OLE protocol. It can store up to 1 gigabyte (limited by disk space).

Hyperlink
Use for hyperlinks. A hyperlink can be a UNC path or a URL. It can store up to 64,000 characters.

Lookup Wizard
Allows to select values or types from other tables.

Field Properties:After you create a field and set its data type, you can set additional field properties. The field's data type determines which other properties you can set. For example, you can control the size of a Text field by setting its Field Size property. For Number and Currency fields, the Field Size property is particularly important, because it determines the range of field values. For example, a one-bit Number field can store only integers ranging from 0 to 255. The Field Size property also determines how much disk space each Number field value requires. Depending on the field size, the number can take up exactly 1, 2, 4, 8, 12, or 16 bytes. Text and Memo fields have variable field value sizes. For these data types, field Size sets the maximum space available for any one value.

Fields also have properties that control the details of information inside them, including a default value, and a validation rule that makes sure the data meets certain criteria. Autonumber allows the following field properties: Caption:-The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed. Field Size:-Determines the amount of space that is allocated for each value. For autonumber fields, only two values are allowed: The Long Integer field size is used for autonumber fields that are not used as replication ids. This is the default value. You should not change this value unless you are creating a replication ID field. Replication is not supported in databases that use a new file format, such as .accdb. This setting makes autonumber fields compatible with other Long Integer Number fields when they are used in relationships or joins. Each field value requires 4 bytes of storage. The Replication ID field size is used for autonumber fields that are used as replication ids in a database replica. Do not use this value unless you are working in or implementing the design of a replicated database. Each field value requires 16 bytes of storage. Format:If you are using an autonumber field as a primary key or as a Replication ID, you should not set this property. Otherwise, choose a number format that meets your specific needs. Specifies whether the field has an index. There are three available values: Yes (No duplicates) Creates a unique index on the field.

Indexed:

Yes (Duplicates OK) Creates a non-unique index on the field. No Removes any index on the field. Do not change this property for a field that is used in a primary key. Without a unique index, it is possible to enter duplicate values, which can break any relationships in which the key is a part. Although you can create an index on a single field by setting the Indexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multifield index by setting this property.

New Values:

Determines whether an autonumber field increments with each new value or uses random numbers. Select one of the following: Increment Starts with the value 1 and incrementally increases by 1 for each new record. Random Starts with a random value and assigns a random value to each new record. Values are of the Long Integer field size, and range from -2,147,483,648 to 2,147,483,647.

Currency allows the following field properties:Caption:- The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed.

Decimal Places

Specifies the number of decimal places to use when displaying numbers.

Default Value Format

Automatically assigns the specified value to this field when a new record is added. Determines the way that the field appears when it is displayed or printed in datasheets or in forms or reports that are bound to the field. You can use any valid number format. In most cases, you should set the Format value to Currency. Specifies whether the field has an index. There are three available values:

Indexed

Yes (No duplicates) Creates a unique index on the field. Yes (Duplicates OK) Creates a non-unique index on the field. No Removes any index on the field. NOTE Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting the Indexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multi-field index by setting this property.

Input Mask Displays editing characters to guide data entry. For example, an input mask might display a dollar sign ($) at the beginning of the field. Required Requires that data be entered in the field.

Smart Tags Attaches a smart tag to the field. Text Align Specifies the default alignment of text within a control. Validation Rule Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with

the Validation Text property. Validation Text Enter a message to display when a value that is entered violates the expression in the Validation Rule property.

DATE/TIME allows the following field properties:Caption The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed. Automatically assigns the specified value to this field when a new record is added. Determines the way that the field appears when it is displayed or printed in datasheets, or in forms or reports that are bound to the field. You can use a predefined format or build your own custom format. List of predefined formats Lists of components that you can use in custom formats IME Mode IME Sentence Mode Indexed

Default Value Format

Controls the conversion of characters in East Asian versions of Windows. Controls the conversion of sentences in East Asian versions of Windows. Specifies whether the field has an index. There are three available values: Yes (No duplicates) Creates a unique index on the field. Yes (Duplicates OK) Creates a non-unique index on the field.

No Removes any index on the field. NOTE Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting the Indexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multi-field index by setting this property.

Input Mask

Displays editing characters to guide data entry. For example, an input mask might display a dollar sign ($) at the beginning of the field. Requires that data be entered in the field. Specifies whether to show the Date Picker control. NOTE If you use an input mask for a Date/Time field, the Date Picker control is unavailable regardless of how you set this property. Attaches a smart tag to the field. Specifies the default alignment of text within a control. Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. Enter a message to display when a value that is entered violates the expression in the Validation Rule property.

Required Show Date Picker

Smart Tags Text Align Validation Rule

Validation Text

HYPERLINK allows the following field properties:Allow Zero Length Append Only

Allows entry (by setting to Yes) of a zero-length string ("") in a Hyperlink, Text, or Memo field. Determines whether to track field value changes. There are two settings: Yes Tracks changes. To view the field value history, rightclick the field, and then click Show column history. No Does not track changes. WARNING Setting this property to No deletes any existing field value history.

Caption

The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed.

Default Value Format

Automatically assigns the specified value to this field when a new record is added. Determines the way that the field appears when it is displayed or printed in datasheets or in forms or reports that are bound to the field. You can define a custom format for a Hyperlink field. Controls the conversion of characters in East Asian versions of Windows. Controls the conversion of sentences in East Asian versions of Windows. Specifies whether the field has an index. There are three

IME Mode IME Sentence Mode Indexed

available values:

Yes (No duplicates) Creates a unique index on the field. Yes (Duplicates OK) Creates a non-unique index on the field. No Removes any index on the field. NOTE Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting theindexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multi-field index by setting this property.

Required Smart Tags Text Align Unicode Compression Validation Rule Validation Text

Requires that data be entered in the field. Attaches a smart tag to the field. Specifies the default alignment of text within a control. Compresses text that is stored in this field when less than 4,096 characters are stored. Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. Enter a message to display when a value that is entered violates the expression in the Validation Rule property.

MEMO allows the following field properties:-

Allow Zero Length Append Only

Allows entry (by setting to Yes) of a zero-length string ("") in a Hyperlink, Text, or Memo field. Determines whether to track field value changes. There are two settings: Yes Tracks changes. To view the field value history, right-click the field, and then click Show column history. No Does not track changes. WARNING Setting this property to No deletes any existing field value history.

Caption

The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed.

Default Value Automatically assigns the specified value to this field when a new record is added. Format Determines the way that the field appears when it is displayed or printed in datasheets or in forms or reports that are bound to the field. You can define a custom format for a Memo field. Controls the conversion of characters in East Asian versions of Windows.

IME Mode

IME Sentence Controls the conversion of sentences in East Asian Mode versions of Windows. Indexed

Specifies whether the field has an index. There are three available values: Yes (No duplicates) Creates a unique index on the field. Yes (Duplicates OK) Creates a non-unique index on the field.

No Removes any index on the field. NOTE Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting theindexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multi-field index by setting this property.

Required Smart Tags Text Align Unicode Compression Validation Rule Validation Text

Requires that data be entered in the field. Attaches a smart tag to the field. Specifies the default alignment of text within a control. Compresses text that is stored in this field when less than 4,096 characters are stored. Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Textproperty. Enter a message to display when a value that is entered violates the expression in the Validation Rule property.

NUMBER allows the following field properties:Caption The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed. Specifies the number of decimal places to use when displaying numbers. Automatically assigns the specified value to this field when a new record is added.

Decimal Places Default Value

Field Size

Select one of the following: Byte Use for integers that range from 0 to 255. Storage requirement is 1 byte. Integer Use for integers that range from -32,768 to 32,767. Storage requirement is 2 bytes. Long Integer Use for integers that range from 2,147,483,648 to 2,147,483,647. Storage requirement is 4 bytes. TIP Use Long Integer when you create a foreign key to relate to another table's autonumber primary key field.

Single Use for numeric floating point values that range from -3.4 x 1038 to 3.4 x 1038 and up to seven significant digits. Storage requirement is 4 bytes. Double Use for numeric floating point values that range from -1.797 x 10308 to 1.797 x 10308 and up to fifteen significant digits. Storage requirement is 8 bytes. Replication ID Use for storing a globally unique identifier required for replication. Storage requirement is 16 bytes. Note that replication is not supported using the .accdb file format. Decimal Use for numeric values that range from -9.999... X 1027to 9.999... X 1027. Storage requirement is 12 bytes. Determines the way that the field appears when it is displayed or printed in datasheets, or in forms or reports that are bound to the field. You can use any valid number format. Specifies whether the field has an index. There are three available values:

Format

Indexed

Yes (No duplicates) Creates a unique index on the field. Yes (Duplicates OK) Creates a non-unique index on the

field. No Removes any index on the field. NOTE Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting the Indexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multi-field index by setting this property.

Input Mask Displays editing characters to guide data entry. For example, an input mask might display a dollar sign ($) at the beginning of the field. Required Requires that data be entered in the field.

Smart Tags Attaches a smart tag to the field. Text Align Validation Rule Validation Text Specifies the default alignment of text within a control. Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. Enter a message to display when a value that is entered violates the expression in the Validation Rule property.

OLE OBJECT allows the following field properties:Caption The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed.

Required Requires that data be entered in the field.

Text Align

Specifies the default alignment of text within a control.

TEXT allows the following field properties:Allow Zero Length Caption Allows entry (by setting to Yes) of a zero-length string ("") in a Hyperlink, Text, or Memo field. The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed. Automatically assigns the specified value to this field when a new record is added. Enter a value from 1 to 255. Text fields can range from 1 to 255 characters. For larger text fields, use the Memo data type. TIP For best performance, always specify the smallest sufficient Field Size. For example, if you are storing postal codes of a known length, you should specify that length as the Field Size. Determines the way that the field appears when it is displayed or printed in datasheets or in forms or reports that are bound to the field. You can define a custom format for a Text field.

Default Value Field Size

Format

IME Mode Controls the conversion of characters in East Asian versions of Windows. IME Sentence Mode Indexed Controls the conversion of sentences in East Asian versions of Windows. Specifies whether the field has an index. There are three available values:

Yes (No duplicates) Creates a unique index on the field. Yes (Duplicates OK) Creates a non-unique index on the field. No Removes any index on the field. NOTE Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting theindexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multi-field index by setting this property.

Required Smart Tags Text Align Unicode Compression

Requires that data be entered in the field. Attaches a smart tag to the field. Specifies the default alignment of text within a control. Compresses text that is stored in this field when less than 4,096 characters are stored.

Validation Rule Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. Validation Text Enter a message to display when a value that is entered violates the expression in the Validation Rule property. YES/NO allows the following field properties:Caption The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed. Automatically assigns the specified value to this field when a new record is added.

Default Value

Format

Determines the way that the field appears when it is displayed or printed in datasheets, or in forms or reports that are bound to the field. Select one of the following:

True/False Displays the value as either True or False. Yes/No Displays the value as either Yes or No. On/Off Displays the value as either On or Off. Specifies whether the field has an index. There are three available values:

Indexed

Yes (No duplicates) Creates a unique index on the field. Yes (Duplicates OK) Creates a non-unique index on the field. No Removes any index on the field. NOTE Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting the Indexed field property, some types of indexes cannot be created in this way. For example, you cannot create a multi-field index by setting this property.

Text Align Specifies the default alignment of text within a control. Validation Rule Validation Text Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. Enter a message to display when a value that is entered violates the expression in the Validation Rule property.

Relational databases

A relational database is one whose components (tables, forms, queries etc) are related (linked). The linkages between database components are created by making relationship links Between them. The relationship can be between: -one component and another (one-to-one relationship), -one component related to several other components (one-to-many) -several database components (many-to-many). Creation of relationships between database components reduces data redundancy and enhances ease of access of the information.

Creation of relationships between database components When you create a relationship between tables, the related fields don't necessarily have to have the same names. However, related fields must have the same data type. Unless the Primary key field is an autonumber field. Ms-access basic 6 An autonumber field can be matched with a number field only if the fieldsize property of both of the matching fields is the same. For example, you can match an autonumber field and a number field if the fieldsize property of both fields is long integer. Even when both matching fields are number fields, they must have exactly the same fieldsize property setting. Defining a one-to-many or a one-to-one relationship 1. Close any tables you have open. You can't create or modify relationships between open tables. 2. Press f11 to switch to the database window.

3. Click relationships on the toolbar. 4. If you haven't yet defined any relationships in your database, the show table dialog box is automatically displayed. If you need to add the tables you want to relate and the show table dialog box isn't displayed, click show table on the toolbar. 5. Double-click the names of the tables you want to relate, and then close the show table dialog box. To create a relationship between a table and itself, add that table twice. 6. Drag the field that you want to relate from one table to the related field in the other table. In most cases, you drag the primary key field (which is displayed in bold text) from one table To a similar field (often with the same name) called the foreign key in the other table (see the illustration below).

7. The edit relationships dialog box is displayed. Check the field names displayed in the two columns to ensure they are correct. You can change them if necessary. Set the relationship options if necessary. 8. Click the create button to create the relationship. 9. Repeat steps 5 through 8 for each pair of tables you want to relate. When you close the relationships window, Microsoft access asks if you want to save the layout. Whether you save the layout or not, the relationships you create are saved in the Database. Note: you can create relationships using queries as well as tables. However, referential integrity isn't enforced with queries.

Queries
A query is a derived item in the database meant to answer specific questions that relate to the information in the database. Queries are handy during data processing.

To find and retrieve just the data that meets conditions that you specify, including data from multiple tables create a query. A query can also update or delete multiple records at the same time, and perform predefined or custom calculations on your data. A query requests data from the database. At its simplest, a query merely fetches all data from a single table. But as you create more complex (and more typical) queries, you can Assemble exactly the data you want (i.e. Unique sets of data that you require at any given time).

Queries can also be used to execute mathematical and logical functions to obtain certain information in the database. Queries are derived from and linked to tables or other queries. (due to these linkages, they tend to largely inflate the size of the database and should thus only be used to execute the intended functions, and stored only if updated information is to be retrieved)

There are various types of queries for different uses: Select queries- used for extracting specific information from a large multi-information table. They can also be helpful in merging related information from different tables. Make-table queries: - used for making sub tables from the main table(s) and queries. Update queries: - important in adding information in the fields of a table. Append queries: - used to copy records from one table/ query to another. Delete query: - to permanently remove unwanted content from the table. Note: Delete query should not be used unless one surely will not require the information to be deleted. Crosstab query: a query that calculates a sum, average, count, or other type of total on records, and then groups the result by two types of information: one down the left side of the datasheet and the other across the top To run a simple select query: in the database window, click queries under objects. Click the Query you want to open. Click open on the database window toolbar. Caution: It's a good idea to make a copy of the data you are changing or moving in an action.

Query, in case you need to restore the data to its original state after running the action query In design view, - Choose the tables or existing queries that contain the fields to use - Select and drag those fields to a grid (the fields can come from just one table, or from Multiple tables, the fields specified for a query control the data that the query retrieves) - Specify criteria and other settings, such as whether to sort the results. To test a new query in design view, just click the run button on the query design toolbar. This will switch you to the results view. If you don't see the results you want, click the design button to return to design view. Note: to stop a query in progress (after you start it), press ctrl + break

Forms:A form is a type of a database object that is primarily used to enter or display data in a database. Most forms are bound to one or more tables and queries in the database. A form's record source refers to the fields in the underlying tables and queries. A form: - Focuses on one record at a time - Can display fields from more than one table

- Can also display pictures and other objects - Can contain a button that prints, opens other objects, or otherwise automates tasks Data entry forms can be created either using a form wizard or in the design view. Once a table with fields is available, it is easy to create a form using the wizard: Click on the forms tab Double click on the create form by using a wizard. This will lead you through a series of steps until you finish creating the form. The form created is linked to the table and information entered in the fields of the form is stored in the table. A form need not contain all the fields from each of the tables or queries that it is based on. When you open a form, Microsoft access retrieves the data from one or more tables, and displays it on the screen with the chosen layout in the form wizard, or with the layout that you created on your own in design view.

Reports:Reports provide a means of organizing and summarizing data. Reports are often used to present an overview highlighting main points and trends. A report can be a simple list, a status report or a monthly production report. With reports, one can prepare: - Mailing labels for various producers

- Produce a directory - Prepare invoices - Present data summaries. A report is made from the data available. There are several ways of preparing a report: Auto report: the quickest way to create a report, but gives least control over the report's structure and appearance. This automatically contains all the fields in its data source, whether table or query. Report wizard: asks you questions and creates a report based on your answers. The report wizard asks which tables or queries the report will be based on, and which fields to use from those data sources. It also asks whether the data is to be grouped, and how it should be sorted and summarized. Creating a report in design view: - gives one control, right from the start. Design view provides you with a toolbox from which you drag selected controls and arrange them on a grid. To see the report as it will appear when printed, it should be viewed in print preview. Different properties may be set for a report, to change how it is viewed or printed. For example, a report's Page Header property determines whether the page header is printed on the page that begins with the Report Header. To view or change a report's properties, just double-click the report selector where the rulers meet. To see more details about a property, click that property and then press F1.

To view a control's properties, double-click the control. Further information is available through the help section within access, and at http://office.microsoft.com/en-gb/training/CR061829401033.aspx

Macros:Microsoft Access provides the ability for you to create macros. A "macro" refers to a set of actions that can be run automatically, and on demand. You could make a macro run when a user presses a certain key, or you could make a macro run everytime your database is opened. For example, if say 90% of your database usage is entering data into the same form, you could create a macro that automatically opens that form every time the database is opened. That way, it saves you from having to click on the Forms tab, then double clicking the form you want to open. Here's how you can go about creating a macro: 1. Ensuring the "Macros" tab is selected, click "New". 2. Use the dropdown menu to select your first action - choose "openform". In the bottom pane, select the form name you wish to open - choose "Individual Form"

3. Use the dropdown menu to select your second action - choose "gotorecord". In the bottom pane, choose the record you want to go to - choose "New". What we're doing here is ensuring that the form doesn't open up a previous record - it goes straight to the end and has a blank record ready for you to enter a new record (this saves time and unnecessary clicks).

4. You're now ready to save your macro. To do this, click on the "Save" icon and enter a name for your macro. Make sure you name this macro "Autoexec". By naming it Autoexec, we are instructing Access to run this macro everytime we open the database.

Testing your Macro Now that you've created your macro, it's time to test it! Close your database and then open it again. You will notice that when you open it, the Individual Form automatically opens and is ready for you to enter a new record. You can also run macros by opening the Macros tab and double clicking on the macro you want to run (or selecting it and clicking "Run").

Das könnte Ihnen auch gefallen