Beruflich Dokumente
Kultur Dokumente
a data access object (DAO) is an object that provides an abstract interface to some type of database or persistence mechanism, providing some specific operations without exposing details of the database. It provides a mapping from application calls to the persistence layer. The advantage of using data access objects is the relatively simple and rigorous separation between two important parts of an application that can and should know almost nothing of each other, and which can be expected to evolve frequently and independently. Changing business logic can rely on the same DAO interface, while changes to persistence logic do not affect DAO clients as long as the interface remains correctly implemented. DATA TYPES IN ACCESS
replica databases at different sites to assign primary key values without the likelihood of duplicates begin assigned. Also called a GUID (Globally Unique IDentifier). If less than 100 new records will normally be added between synchronizations of the replica databases, this type will probably not be needed. Date/Time. Access stores Dates as 8-byte floating point numbers, where the integer part refers to the day, and the fraction part refers to the time. While Now() + 1/24 is theoretically one hour from now, use the DateAdd() function to avoid rounding errors if you plan to use the result in comparisons. When constructing queries, keep in mind that if a Date/Time field contains a fraction part, it will not match a criteria which is just a date: Now() is not equivalent to Date(), though Int(Now()) is equivalent to Date(). Yes/No. A Logical field can be displayed as Yes/No, True/False, or On/Off. In code, use the constants True and False, equivalent to -1 and 0 respectively. Unfortunately, Access 95 onwards do not permit Null values in Yes/No fields. Memo. Similar to a Memo field in xBase. Up to 64K of text. Memos cannot include formatting (e.g. bolding a word). However, they are searchable. OLE Object. Use this type to store pictures, audio, video, or other BLOBs (Binary Large OBjects). Double-clicking fires up the associated application. Access 2 and later support in-place activation, e.g. WinWord documents can be stored and edited as OLE objects in a form (though Access will not be able to search them). Hyperlink. (Access 97 onwards.) Use this type to store the location of a file on your computer, a local network, or the world wide web. The field contains three parts separated by pound signs (#), with each part up to 2K in size. The first part is the text to be displayed, the second is the address of the file, and the third can reference a named section within the file. Example:
Access Tips#http://allenbrowne.com/tips.html#
Visual Basic data types are not identical to these field types. In modules, Access supports only the following types:
boolean (Access 95 onwards. Use Integer in Access 1 and 2), byte (Access 95 onwards. Use Integer in Access 1 and 2), integer, long, single, double, currency, string, object, variant, date (Access 95 onwards. Use Variant in Access 1 and 2).
Variants are very flexible: if the contents look numeric they can treated arithmetically or as strings. For this reason, Access uses ampersand (&) as a concatenation operator. Under certain circumstances, you will need to specifically type-cast variants with CInt(), CStr(), CDec(), CDate(), etc. This is especially true of dates in international settings. Only variants can contain the values Null, Empty, or Error. In Access a Null is a nonentry and is not the same as a zero-length string. Use IsNull() to test for Nulls, or Nz() to assign an assumption for Nulls. User-defined types are permitted in all versions, but only in Access 95 and later can userdefined types be based on other user-defined types. The StrConv() function provides powerful string conversions (Access 95 onwards).
Data types
Think of a field's data type as a set of qualities that applies to all the values contained in the field and that determines what kind of data those values can be. For example, values that are stored in a Text field can contain only letters, numbers, and a limited set of punctuation characters. In addition, a Text field can contain a maximum of 255 characters. There are ten different data types in Access:
Attachment Files, such as digital photos. Multiple files can be attached per record. This data type is not available in earlier versions of Access.
Attachment
Purpose Use an attachment field to attach multiple files, such as images, to a record.
AutoNumber
Purpose Use an AutoNumber field to provide a unique value that serves no other purpose than to make each record unique. The most common use for an AutoNumber field is as a primary key, especially when no suitable natural key (a key that is based on a data field) is available. An AutoNumber field value requires 4 or 16 bytes, depending on the value of its Field Size property.
Suppose that you have a table that stores contacts' information. You can use contact names as the primary key for that table, but how do you handle two contacts with exactly the same name? Names are unsuitable natural keys, because they are often not unique. If you use an AutoNumber field, each record is guaranteed to have a unique identifier.
Currency
Purpose Use to store monetary data. Data in a Currency field is not rounded off during calculations. A Currency field is accurate to 15 digits to the left of the decimal point and 4 digits to the right. Each Currency field value requires 8 bytes of storage.
Date/Time
Purpose Use to store time-based data.
Hyperlink
Purpose Use to store a hyperlink, such as an e-mail address or a Web site URL. A hyperlink can be a UNC (universal naming convention (UNC): A naming convention for files that provides a machine-independent means of locating the file. Rather than specifying a drive letter and path, a UNC name uses the syntax \\server\share\path\filename.) path or a URL (Uniform Resource Locator (URL): An address that specifies a protocol (such as HTTP or FTP) and a location of an object, document, World Wide Web page, or other destination on the Internet or an intranet, for example: http://www.microsoft.com/.). It can store up to 2048 characters.
Memo Long blocks of text and text that use text formatting. A typical use of a Memo field would be a detailed product description.
Memo
Purpose Use to store a block of text that is more than 255 characters in length and is formatted text.
Number Numeric values, such as distances. Note that there is a separate data type for currency.
Number
Purpose Use to store a numeric value that isn't a monetary value. If you might use the values in the field to perform a calculation, use the Number data type.
OLE Object OLE objects (OLE object: An object supporting the OLE protocol for object linking and embedding. An OLE object from an OLE server (for example, a Windows Paint picture or a Microsoft Excel worksheet) can be linked or embedded in a field, form, or report.), such as Word documents.
OLE Object
Purpose Use to attach an OLE Object, such as a Microsoft Office Excel spreadsheet, to a record. If you want to use OLE (OLE: A program-integration technology that you can use to share information between programs. All Office programs support OLE, so you can share information through linked and embedded objects.) features, you must use the OLE Object data type. In most cases, you should use an Attachment field instead of an OLE Object field. OLE Object fields support fewer file types than Attachment fields support. In addition, OLE Object fields do not allow you to attach multiple files to a single record.
Text
Purpose Use to store up to 255 characters of text. Requires that data be entered in the field.
Yes/No
Purpose Use to store a Boolean value.