From 66c67bb6352d28a6b748e837a8a0f89fee9f4879 Mon Sep 17 00:00:00 2001 From: Pieter Germishuys Date: Fri, 21 Sep 2018 17:03:15 +0200 Subject: [PATCH 1/2] Provide spaces between words and links (#191) --- .../Reference/User-Interface-Help/option-base-statement.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Reference/User-Interface-Help/option-base-statement.md b/Language/Reference/User-Interface-Help/option-base-statement.md index 75d605d2eaf..022a1824087 100644 --- a/Language/Reference/User-Interface-Help/option-base-statement.md +++ b/Language/Reference/User-Interface-Help/option-base-statement.md @@ -11,7 +11,7 @@ ms.date: 06/08/2017 # Option Base Statement -Used at [module level](../../Glossary/vbe-glossary.md#module-level) to declare the default lower bound for[array](../../Glossary/vbe-glossary.md#array) subscripts. +Used at [module level](../../Glossary/vbe-glossary.md#module-level) to declare the default lower bound for [array](../../Glossary/vbe-glossary.md#array) subscripts. ## Syntax @@ -19,7 +19,7 @@ Used at [module level](../../Glossary/vbe-glossary.md#module-level) to declare t ## Remarks -Because the default base is **0**, the **Option Base** statement is never required. If used, the[statement](../../Glossary/vbe-glossary.md#statement) must appear in a[module](../../Glossary/vbe-glossary.md#module) before any[procedures](../../Glossary/vbe-glossary.md#procedure). **Option** **Base** can appear only once in a module and must precede array[declarations](../../Glossary/vbe-glossary.md#declaration) that include dimensions. +Because the default base is **0**, the **Option Base** statement is never required. If used, the [statement](../../Glossary/vbe-glossary.md#statement) must appear in a [module](../../Glossary/vbe-glossary.md#module) before any [procedures](../../Glossary/vbe-glossary.md#procedure). **Option** **Base** can appear only once in a module and must precede array [declarations](../../Glossary/vbe-glossary.md#declaration) that include dimensions. **Note** The **To** clause in the **Dim**, **Private**, **Public**, **ReDim**, and **Static** statements provides a more flexible way to control the range of an array's subscripts. However, if you don't explicitly set the lower bound with a **To** clause, you can use **Option Base** to change the default lower bound to 1. The base of an array created with the the **ParamArray** keyword is zero; **Option Base** does not affect **ParamArray** (or the **Array** function, when qualified with the name of its type library, for example **VBA.Array**). From 55675c376c6b8059bd83d148b3269c6f6e487aa9 Mon Sep 17 00:00:00 2001 From: Linda Caputo Date: Fri, 21 Sep 2018 20:31:26 -0700 Subject: [PATCH 2/2] Merge lcc-updates-921 to master (#193) * Edit pass on Concepts > ADO, Controls * Edit pass on Concepts > Criteria-Expressions * Edits to Concepts > DAO * Edit pass on Concepts > Date-Time * Edit pass on Concepts > Error Codes * Fixed formatting; removed redirected topics * Cleaned up contributor info * Removed extra redirection file * Fixed broken image link * Removed contributor images --- .openpublishing.redirection.json | 69 ++- .../bind-a-form-to-an-ado-recordset.md | 18 +- .../create-an-ado-connection-string.md | 30 +- ...of-activex-data-objects-in-visual-basic.md | 31 +- .../addallto-a-combo-box-or-list-box.md | 15 +- ...rs-to-add-items-to-an-unbound-combo-box.md | 22 +- .../assign-a-control-a-value-from-a-table.md | 12 +- ...ll-procedures-in-a-subform-or-subreport.md | 14 +- ...rm-if-the-main-form-contains-no-records.md | 8 +- ...-when-moving-between-controls-on-a-form.md | 10 +- .../refer-to-tab-control-objects-in-vba.md | 77 +-- .../avg-function-microsoft-access-sql.md | 26 +- ...te-fields-in-domain-aggregate-functions.md | 9 +- .../count-function-microsoft-access-sql.md | 26 +- .../date-and-time-criteria-expressions.md | 15 +- ...-time-criteria-from-a-control-on-a-form.md | 27 +- .../functions-alphabetical-list.md | 340 ++++++----- .../functions-category-list.md | 542 +++++++----------- ...e-quotation-marks-in-string-expressions.md | 45 +- .../min-max-functions-microsoft-access-sql.md | 43 +- ...multiple-fields-in-criteria-expressions.md | 20 +- .../numeric-criteria-expressions.md | 10 +- ...meric-criteria-from-a-control-on-a-form.md | 18 +- .../quotation-marks-in-strings.md | 107 ---- .../restrict-data-to-a-subset-of-records.md | 34 +- ...rt-records-in-case-sensitiveascii-order.md | 29 +- ...v-stdevp-functions-microsoft-access-sql.md | 32 +- .../sum-function-microsoft-access-sql.md | 30 +- .../textual-criteria-expressions.md | 16 +- ...xtual-criteria-from-a-control-on-a-form.md | 24 +- ...multiple-fields-in-criteria-expressions.md | 41 -- .../use-numeric-criteria-in-expressions.md | 21 - .../use-textual-criteria-expressions.md | 30 - ...var-varp-functions-microsoft-access-sql.md | 24 +- .../add-a-record-to-a-dao-recordset.md | 28 +- ...to-many-relationship-in-a-dao-recordset.md | 18 +- ...he-number-of-records-in-a-dao-recordset.md | 25 +- .../create-a-dao-recordset-from-a-form.md | 14 +- .../create-a-dao-recordset-from-a-query.md | 13 +- ...et-from-a-table-in-the-current-database.md | 8 +- .../create-a-user-defined-property.md | 8 +- .../delete-a-record-from-a-dao-recordset.md | 15 +- .../detect-the-limits-of-a-dao-recordset.md | 29 +- ...t-data-from-a-record-in-a-dao-recordset.md | 32 +- ...set-type-or-snapshot-type-dao-recordset.md | 25 +- ...-a-record-in-a-table-type-dao-recordset.md | 26 +- ...the-current-position-in-a-dao-recordset.md | 20 +- .../make-bulk-changes-to-a-dao-recordset.md | 15 +- .../manipulate-multivalued-fields-with-dao.md | 16 +- .../mark-a-position-in-a-dao-recordset.md | 26 +- .../modify-a-query-from-a-dao-recordset.md | 14 +- ...y-an-existing-record-in-a-dao-recordset.md | 23 +- .../move-through-a-dao-recordset.md | 29 +- ...and-write-to-a-field-in-a-dao-recordset.md | 24 +- ...rn-a-random-record-from-a-dao-recordset.md | 6 +- ...-of-data-access-objects-in-visual-basic.md | 32 +- .../sort-data-in-a-dao-recordset.md | 16 +- ...t-s-record-with-a-form-s-current-record.md | 10 +- ...n-changes-to-a-table-type-dao-recordset.md | 10 +- .../use-transactions-in-a-dao-recordset.md | 18 +- .../work-with-attachments-in-dao.md | 24 +- access/Concepts/Date-Time/calculate-age.md | 12 +- ...culate-and-display-specific-date-values.md | 57 +- .../Date-Time/calculate-elapsed-time.md | 71 +-- ...umber-of-working-days-between-two-dates.md | 10 +- ...s-dates-regardless-of-regional-settings.md | 8 +- ...y-date-and-time-in-criteria-expressions.md | 13 +- .../Error-Codes/comparison-of-data-types.md | 25 +- .../custom-methods-and-properties.md | 10 +- .../elements-of-run-time-error-handling.md | 117 ++-- access/Concepts/Error-Codes/error-trapping.md | 30 +- ...improvements-in-compilation-performance.md | 14 +- ...actions-and-methods-of-the-docmd-object.md | 24 +- .../Error-Codes/program-with-class-modules.md | 46 +- ...scoping-and-object-naming-compatibility.md | 50 +- ...ants-in-microsoft-access-2002-and-later.md | 16 +- .../order-by-clause-microsoft-access-sql.md | 12 +- api/Access.ComboBox.md | 41 +- api/Access.DoCmd.SendObject.md | 10 +- api/Access.Form.md | 31 +- api/Access.ListBox.md | 21 +- api/Access.SubForm.md | 28 +- api/TOC.md | 70 ++- 83 files changed, 1243 insertions(+), 1812 deletions(-) delete mode 100644 access/Concepts/Criteria-Expressions/quotation-marks-in-strings.md delete mode 100644 access/Concepts/Criteria-Expressions/use-multiple-fields-in-criteria-expressions.md delete mode 100644 access/Concepts/Criteria-Expressions/use-numeric-criteria-in-expressions.md delete mode 100644 access/Concepts/Criteria-Expressions/use-textual-criteria-expressions.md diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index 1dc6ff4e92c..c23431a00e6 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -6,7 +6,7 @@ }, { "source_path": "access/Concepts/Miscellaneous/alter-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/alter-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/alter-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/asc-desc-microsoft-access-sql-reserved-words.md", @@ -14,35 +14,35 @@ }, { "source_path": "access/Concepts/Miscellaneous/by-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/by-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/by-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/container-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/container-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/container-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/create-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/create-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/create-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/delete-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/delete-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/delete-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/drop-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/drop-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/drop-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/first-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/first-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/first-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/from-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/from-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/from-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/index-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/index-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/index-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/in-microsoft-access-sql-reserved-word.md", @@ -50,67 +50,86 @@ }, { "source_path": "access/Concepts/Miscellaneous/insert-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/insert-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/insert-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/into-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/into-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/into-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/last-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/last-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/last-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/on-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/on-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/on-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/schema-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/schema-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/schema-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/select-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/select-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/select-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/selectschema-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/selectschema-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/selectschema-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/selectsecurity-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/selectsecurity-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/selectsecurity-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/to-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/to-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/to-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/updateidentity-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/updateidentity-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/updateidentity-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/update-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/update-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/update-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/updateowner-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/updateowner-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/updateowner-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/updatesecurity-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/updatesecurity-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/updatesecurity-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/user-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/user-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/user-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/view-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/view-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/view-microsoft-access-sql-reserved-word" }, { "source_path": "access/Concepts/Miscellaneous/with-microsoft-access-sql-reserved-word.md", - "redirect_url": "/office/vba/access/concepts/Structured-Query-Language/with-microsoft-access-sql-reserved-word" + "redirect_url": "/office/vba/access/concepts/structured-query-language/with-microsoft-access-sql-reserved-word" + }, + { + "source_path": "access/Concepts/Criteria-Expressions/quotation-marks-in-strings.md", + "redirect_url": "/office/vba/access/concepts/criteria-expressions/include-quotation-marks-in-string-expressions" + }, + { + "source_path": "access/Concepts/Criteria-Expressions/use-multiple-fields-in-criteria-expressions.md", + "redirect_url": "/office/vba/access/concepts/criteria-expressions/multiple-fields-in-criteria-expressions" + }, + + { + "source_path": "access/Concepts/Criteria-Expressions/use-numeric-criteria-in-expressions.md", + "redirect_url": "/office/vba/access/concepts/criteria-expressions/numeric-criteria-expressions" + }, + + { + "source_path": "access/Concepts/Criteria-Expressions/use-textual-criteria-expressions.md", + "redirect_url": "/office/vba/access/concepts/criteria-expressions/textual-criteria-expressions" } + ] } diff --git a/access/Concepts/ActiveX-Data-Objects/bind-a-form-to-an-ado-recordset.md b/access/Concepts/ActiveX-Data-Objects/bind-a-form-to-an-ado-recordset.md index 5c33c5a8304..d95f05eb26e 100644 --- a/access/Concepts/ActiveX-Data-Objects/bind-a-form-to-an-ado-recordset.md +++ b/access/Concepts/ActiveX-Data-Objects/bind-a-form-to-an-ado-recordset.md @@ -1,25 +1,17 @@ --- -title: Bind a Form to an ADO Recordset +title: Bind a form to an ADO Recordset ms.prod: access ms.assetid: de85b07c-aa2d-7cf6-e0da-70b682f1bdd0 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Bind a Form to an ADO Recordset +# Bind a form to an ADO Recordset -To bind an Access form to a recordset, you must set the form's **Recordset** property to an open ADO **Recordset** object. A form must meet two general requirements for the form to be updatable when it is bound to an ADO recordset. The general requirements are: +To bind an Access form to a recordset, you must set the form's **Recordset** property to an open ADO **Recordset** object. A form must meet two general requirements for the form to be updatable when it is bound to an ADO recordset. The general requirements are: - -- The underlying ADO recordset must be updatable via ADO. - +- The underlying ADO recordset must be updatable via ADO. - The recordset must contain one or more fields that are uniquely indexed, such as a table's primary key. - - - - - - ```vb Private Sub Form_Open(Cancel As Integer) diff --git a/access/Concepts/ActiveX-Data-Objects/create-an-ado-connection-string.md b/access/Concepts/ActiveX-Data-Objects/create-an-ado-connection-string.md index bd8b82407b6..d07db8712a2 100644 --- a/access/Concepts/ActiveX-Data-Objects/create-an-ado-connection-string.md +++ b/access/Concepts/ActiveX-Data-Objects/create-an-ado-connection-string.md @@ -1,47 +1,39 @@ --- -title: Create an ADO Connection String +title: Create an ADO connection string ms.prod: access ms.assetid: ac29e820-ffbf-a15b-e13d-c9190dfad6ab -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Create an ADO Connection String - -To connect to a data source, you must specify a connection string, the parameters of which might differ for each provider and data source. ADO directly supports five arguments in a connection string. Other arguments are passed to the provider that is named in the _Provider_ argument without any processing by ADO. - +# Create an ADO connection string +To connect to a data source, you must specify a connection string, the parameters of which might differ for each provider and data source. ADO directly supports five arguments in a connection string. Other arguments are passed to the provider that is named in the _Provider_ argument without any processing by ADO. |**Argument**|**Description**| |:-----|:-----| | _Provider_|Specifies the name of a provider to use for the connection.| | _File Name_|Specifies the name of a provider-specific file (for example, a persisted data source object) containing preset connection information.| | _URL_|Specifies the connection string as an absolute URL identifying a resource, such as a file or directory.| -| _Remote Provider_|Specifies the name of a provider to use when opening a client-side connection. (Remote Data Service only.)| -| _Remote Server_|Specifies the path name of the server to use when opening a client-side connection. (Remote Data Service only.)| - -The following example - - +| _Remote Provider_|Specifies the name of a provider to use when opening a client-side connection (Remote Data Service only).| +| _Remote Server_|Specifies the path name of the server to use when opening a client-side connection (Remote Data Service only).| +## Example ```vb m_sConnStr = "Provider='SQLOLEDB';Data Source='MySqlServer';" & _ "Initial Catalog='Northwind';Integrated Security='SSPI';" ``` -The only ADO parameter supplied in this connection string was "Provider=SQLOLEDB", which indicated the Microsoft OLE DB Provider for SQL Server. Other valid parameters that can be passed in the connection string can be determined by referring to individual providers' documentation. -To open the connection, simply pass the connection string as the first argument in the **Connection** object's **Open** method: - +The only ADO parameter supplied in this connection string was `Provider=SQLOLEDB`, which indicated the Microsoft OLE DB Provider for SQL Server. Other valid parameters that can be passed in the connection string can be determined by referring to individual providers' documentation. +To open the connection, simply pass the connection string as the first argument in the **Connection** object's **Open** method: ```vb -objConn.Open m_sConnStr + objConn.Open m_sConnStr ``` -It is also possible to supply much of this information by setting properties of the **Connection** object before opening the connection. For example, you could achieve the same effect as the connection string above by using the following code: - - +It is also possible to supply much of this information by setting properties of the **Connection** object before opening the connection. For example, you could achieve the same effect as the previous connection string by using the following code: ```vb With objConn diff --git a/access/Concepts/ActiveX-Data-Objects/set-properties-of-activex-data-objects-in-visual-basic.md b/access/Concepts/ActiveX-Data-Objects/set-properties-of-activex-data-objects-in-visual-basic.md index 056c3c6c776..62ec45ed7f5 100644 --- a/access/Concepts/ActiveX-Data-Objects/set-properties-of-activex-data-objects-in-visual-basic.md +++ b/access/Concepts/ActiveX-Data-Objects/set-properties-of-activex-data-objects-in-visual-basic.md @@ -1,21 +1,20 @@ --- -title: Set Properties of ActiveX Data Objects in Visual Basic +title: Set properties of ActiveX Data Objects in Visual Basic ms.prod: access ms.assetid: 54955634-d354-54ff-495b-1f696e392dfe -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Set Properties of ActiveX Data Objects in Visual Basic +# Set properties of ActiveX Data Objects in Visual Basic -ActiveX Data Objects (ADO) enable you to manipulate the structure of your database and the data it contains from Visual Basic. Many ADO objects correspond to objects that you see in your database—for example, a **Table** object corresponds to an Access table. A **Field** object corresponds to a field in a table. +ActiveX Data Objects (ADO) enable you to manipulate the structure of your database and the data it contains from Visual Basic. Many ADO objects correspond to objects that you see in your database—for example, a **Table** object corresponds to an Access table. A **Field** object corresponds to a field in a table. Most of the properties you can set for ADO objects are ADO properties. These properties are defined by the Access database engine and are set the same way in any application that includes the Access database engine. Some properties that you can set for ADO objects are defined by Access, and are not automatically recognized by the Access database engine. How you set properties for ADO objects depends on whether a property is defined by the Access database engine or by Access. -## Setting ADO Properties for ADO Objects - -To set a property that is defined by the Access database engine, refer to the object in the ADO hierarchy. The easiest and fastest way to do this is to create object variables that represent the different objects you need to work with, and refer to the object variables in subsequent steps in your code. For example, the following code creates a new **TableDef** object and sets its **Name** property: +## Set ADO properties for ADO objects +To set a property that is defined by the Access database engine, refer to the object in the ADO hierarchy. The easiest and fastest way to do this is to create object variables that represent the different objects you need to work with, and refer to the object variables in subsequent steps in your code. For example, the following code creates a new **TableDef** object and sets its **Name** property: ```vb Dim tbl As New ADOX.Table @@ -25,19 +24,17 @@ tbl.Name = "Contacts" ``` -## Setting Access Properties for ADO Objects - -When you set a property that is defined by Access, but applies to an ADO object, the Access database engine does not automatically recognize the property as a valid property. The first time you set the property, you must create the property and append it to the **Properties** collection of the object to which it applies. Once the property is in the **Properties** collection, it can be set in the same manner as any ADO property. - -If the property is set for the first time in the user interface, it is automatically added to the **Properties** collection, and you can set it normally. +## Set Access properties for ADO objects -When writing procedures to set properties defined by Access, you should include error-handling code to verify that the property you are setting already exists in the **Properties** collection. +When you set a property that is defined by Access, but applies to an ADO object, the Access database engine does not automatically recognize the property as a valid property. The first time you set the property, you must create the property and append it to the **Properties** collection of the object to which it applies. After the property is in the **Properties** collection, it can be set in the same manner as any ADO property. -Keep in mind that when you create the property, you must correctly specify its **Type** property before you append it to the **Properties** collection. You can determine the **Type** property based on the information in the Settings section of the Help topic for the individual property. The following table provides some guidelines for determining the setting of the **Type** property. +If the property is set for the first time in the user interface, it is automatically added to the **Properties** collection, and you can set it normally. +When writing procedures to set properties defined by Access, you should include error-handling code to verify that the property you are setting already exists in the **Properties** collection. +Keep in mind that when you create the property, you must correctly specify its **Type** property before you append it to the **Properties** collection. You can determine the **Type** property based on the information in the Settings section of the Help topic for the individual property. The following table provides some guidelines for determining the setting of the **Type** property. -|**If the property setting is**|**Then the Type property setting should be**| +|If the property setting is|The Type property setting should be| |:-----|:-----| |A string|**adLongVarWChar** or **adVarWChar**| |**True** / **False**|**adBoolean**| @@ -45,9 +42,7 @@ Keep in mind that when you create the property, you must correctly specify its The following table lists some Access-defined properties that apply to ADO objects. - - -|**ADO object**|**Microsoft Access-defined properties**| +|ADO object|Microsoft Access-defined properties| |:-----|:-----| |**Connection**|**AppTitle**, **AppIcon**, **StartupShowDBWindow**, **StartupShowStatusBar**, **AllowShortcutMenus**, **AllowFullMenus**, **AllowBuiltInToolbars**, **AllowToolbarChanges**, **AllowBreakIntoCode**, **AllowSpecialKeys**, **Replicable**, **ReplicationConflictFunction**| |**Table**|**DatasheetBackColor**, **DatasheetCellsEffect**, **DatasheetFontHeight**, **DatasheetFontItalic**, **DatasheetFontName**, **DatasheetFontUnderline**, **DatasheetFontWeight**, **DatasheetForeColor**, **DatasheetGridlinesBehavior**, **DatasheetGridlinesColor**, **Description**, **FrozenColumns**, **RowHeight**, **ShowGrid**| diff --git a/access/Concepts/Controls/addallto-a-combo-box-or-list-box.md b/access/Concepts/Controls/addallto-a-combo-box-or-list-box.md index 60c306ec4ea..3e2dab25c00 100644 --- a/access/Concepts/Controls/addallto-a-combo-box-or-list-box.md +++ b/access/Concepts/Controls/addallto-a-combo-box-or-list-box.md @@ -1,21 +1,18 @@ --- -title: Add "(All)" to a Combo Box or List Box +title: Add "(All)" to a combo box or list box ms.prod: access ms.assetid: f246db25-84b1-736f-8a79-16b9eea9cbda -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Add "(All)" to a Combo Box or List Box - -When you use a list box or combo box to enter selection criteria, you might want to be able to specify all records. The AddAllToList procedure illustrates how to add an **(All)** entry at the top of a combo box. - -To utilize the AddAllToList procedure, you must set the **RowSourceType** property of the combo box or list box to **AddAllToList**. - -You can specify a different item than **(All)** to add to the list by setting the **Tag** property of the combo box or list box. For example, you can add **** to the top of the list by setting the value of the **Tag** property to `1;`. +# Add "(All)" to a combo box or list box +When you use a list box or combo box to enter selection criteria, you might want to be able to specify all records. The AddAllToList procedure illustrates how to add an **(All)** entry at the top of a combo box. +To utilize the AddAllToList procedure, you must set the **RowSourceType** property of the combo box or list box to **AddAllToList**. +You can specify a different item than **(All)** to add to the list by setting the **Tag** property of the combo box or list box. For example, you can add `` to the top of the list by setting the value of the **Tag** property to `1;`. ```vb Function AddAllToList(ctl As Control, lngID As Long, lngRow As Long, _ diff --git a/access/Concepts/Controls/allow-users-to-add-items-to-an-unbound-combo-box.md b/access/Concepts/Controls/allow-users-to-add-items-to-an-unbound-combo-box.md index 0cdeea8d324..685fb502e2e 100644 --- a/access/Concepts/Controls/allow-users-to-add-items-to-an-unbound-combo-box.md +++ b/access/Concepts/Controls/allow-users-to-add-items-to-an-unbound-combo-box.md @@ -1,21 +1,26 @@ --- -title: Allow Users to Add Items to an Unbound Combo Box +title: Allow users to add items to an unbound combo box ms.prod: access ms.assetid: 654cefc7-cbd4-5e8e-adc7-919c6977ac6a -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Allow Users to Add Items to an Unbound Combo Box +# Allow users to add items to an unbound combo box -The following example uses the **NotInList** event to add an item to a combo box. +The following example uses the **NotInList** event to add an item to a combo box. -To try this example, create a combo box called **Colors** on a form. Set the combo box's **[LimitToList](../../../api/Access.ComboBox.LimitToList.md)** property to **Yes**. To populate the combo box, set the combo box's **[RowSourceType](../../../api/Access.ComboBox.RowSourceType.md)** property to **Value List**, and supply a list of values separated by semicolons as the setting for the **[RowSource](../../../api/Access.ComboBox.RowSource.md)** property. For example, you might supply the following values as the setting for this property: Red; Green; Blue. +To try this example: -Next, add the following event procedure to the form. Switch to Form view and enter a new value in the text portion of the combo box. +1. Create a combo box called **Colors** on a form. +2. Set the combo box's **[LimitToList](../../../api/Access.ComboBox.LimitToList.md)** property to **Yes**. +3. To populate the combo box, set the combo box's **[RowSourceType](../../../api/Access.ComboBox.RowSourceType.md)** property to **Value List**. +4. Supply a list of values separated by semicolons as the setting for the **[RowSource](../../../api/Access.ComboBox.RowSource.md)** property. For example, you might supply the following values as the setting for this property: Red; Green; Blue. + +5. Add the following event procedure to the form. Switch to Form view and enter a new value in the text portion of the combo box. ```vb Private Sub Colors_NotInList(NewData As String, _ @@ -42,6 +47,9 @@ End Sub ``` - **Note** This example adds an item to an unbound combo box. When you add an item to a bound combo box, you add a value to a field in the underlying data source. In most cases you cannot simply add one field in a new record. Depending on the structure of data in the table, you probably will need to add one or more fields to fulfill data requirements. For instance, a new record must include values for any fields comprising the primary key. If you need to add items to a bound combo box dynamically, you must prompt the user to enter data for all required fields, save the new record, and then requery the combo box to display the new value. +> [!NOTE] +> This example adds an item to an unbound combo box. When you add an item to a bound combo box, you add a value to a field in the underlying data source. In most cases you cannot simply add one field in a new record. Depending on the structure of data in the table, you probably will need to add one or more fields to fulfill data requirements. +> +> For example, a new record must include values for any fields comprising the primary key. If you need to add items to a bound combo box dynamically, you must prompt the user to enter data for all required fields, save the new record, and then requery the combo box to display the new value. diff --git a/access/Concepts/Controls/assign-a-control-a-value-from-a-table.md b/access/Concepts/Controls/assign-a-control-a-value-from-a-table.md index 382b367ad97..82e2fac1278 100644 --- a/access/Concepts/Controls/assign-a-control-a-value-from-a-table.md +++ b/access/Concepts/Controls/assign-a-control-a-value-from-a-table.md @@ -1,19 +1,17 @@ --- -title: Assign a Control a Value From a Table +title: Assign a control a value from a table ms.prod: access ms.assetid: d9bba7e3-bca0-00df-3753-dc99ae767759 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Assign a Control a Value From a Table +# Assign a control a value from a table -You can use the **DLookup** function to display the value of a field that is not in the record source for your form or report. For example, suppose you have a form based on an Order Details table. The form displays the OrderID, ProductID, UnitPrice, Quantity, and Discount fields. However, the UnitPrice field is in another table: Products. You could use the **DLookup** function in a calculated control to display the UnitPrice on the same form when the user selects a product. +You can use the **DLookup** function to display the value of a field that is not in the record source for your form or report. For example, suppose you have a form based on an Order Details table. The form displays the OrderID, ProductID, UnitPrice, Quantity, and Discount fields. However, the UnitPrice field is in another table: Products. You could use the **DLookup** function in a calculated control to display the UnitPrice on the same form when the user selects a product. The following example populates the UnitPrice text box with the price of the product currently selected in the ProductID combo box. - - ```vb Private Sub ProductID_AfterUpdate() @@ -26,5 +24,5 @@ Private Sub ProductID_AfterUpdate() End Sub ``` -The **DLookup** function has three arguments. The first specifies the field you are looking up (UnitPrice); the second specifies the table (Products); and the third specifies which value to find (the value for the record where the ProductID is the same as the ProductID on the current record in the Orders subform). +The **DLookup** function has three arguments. The first specifies the field you are looking up (UnitPrice); the second specifies the table (Products); and the third specifies which value to find (the value for the record where the ProductID is the same as the ProductID on the current record in the Orders subform). diff --git a/access/Concepts/Controls/call-procedures-in-a-subform-or-subreport.md b/access/Concepts/Controls/call-procedures-in-a-subform-or-subreport.md index 82973b1927f..4c10411fea8 100644 --- a/access/Concepts/Controls/call-procedures-in-a-subform-or-subreport.md +++ b/access/Concepts/Controls/call-procedures-in-a-subform-or-subreport.md @@ -1,18 +1,18 @@ --- -title: Call Procedures in a Subform or Subreport +title: Call procedures in a subform or subreport ms.prod: access ms.assetid: d0128a6c-f85b-fbf0-22cb-bfd4a8eca3c8 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Call Procedures in a Subform or Subreport +# Call procedures in a subform or subreport -You can call a procedure in a module associated with a subform or subreport in one of two ways. If the form containing the subform is open in Form view, you can refer to the procedure as a method on the subform. The following example shows how to call the procedure GetProductID in the Orders subform, which is bound to a subform control on the Orders form: - -In the Orders Subform class module, enter this code: +You can call a procedure in a module associated with a subform or subreport in one of two ways. If the form containing the subform is open in Form view, you can refer to the procedure as a method on the subform. +The following example shows how to call the procedure GetProductID in the Orders subform, which is bound to a subform control on the Orders form: +In the Orders Subform class module, enter this code: ```vb Public Function GetProductID() As Variant @@ -23,8 +23,6 @@ End Function The following code illustrates how to call the GetProductID procedure. - - ```vb Forms!Orders![Orders Subform].Form.GetProductID ``` diff --git a/access/Concepts/Controls/hide-a-subform-if-the-main-form-contains-no-records.md b/access/Concepts/Controls/hide-a-subform-if-the-main-form-contains-no-records.md index 922bd6e5b7a..ca45c7d070f 100644 --- a/access/Concepts/Controls/hide-a-subform-if-the-main-form-contains-no-records.md +++ b/access/Concepts/Controls/hide-a-subform-if-the-main-form-contains-no-records.md @@ -1,14 +1,14 @@ --- -title: Hide a Subform if the Main Form Contains No Records +title: Hide a subform if the main form contains no records ms.prod: access ms.assetid: 20482340-0c86-71c9-3ba1-b9f515397fbc -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Hide a Subform if the Main Form Contains No Records +# Hide a subform if the main form contains no records -The following example illustrates how to hide a subform named _Orders_Subform_ if its main form does not contain any records. The code resides in the main form's **[Current](../../../api/Access.Form.Current.md)** event procedure. +The following example illustrates how to hide a subform named _Orders_Subform_ if its main form does not contain any records. The code resides in the main form's **[Current](../../../api/Access.Form.Current.md)** event procedure. ```vb diff --git a/access/Concepts/Controls/prevent-the-accidental-erasure-of-data-when-moving-between-controls-on-a-form.md b/access/Concepts/Controls/prevent-the-accidental-erasure-of-data-when-moving-between-controls-on-a-form.md index 85aabb88115..6da983324d8 100644 --- a/access/Concepts/Controls/prevent-the-accidental-erasure-of-data-when-moving-between-controls-on-a-form.md +++ b/access/Concepts/Controls/prevent-the-accidental-erasure-of-data-when-moving-between-controls-on-a-form.md @@ -1,18 +1,18 @@ --- -title: Prevent the Accidental Erasure of Data When Moving Between Controls on a Form +title: Prevent the accidental erasure of data when moving between controls on a form ms.prod: access ms.assetid: 1733caa5-5067-e6d9-b614-51053180f22e -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Prevent the Accidental Erasure of Data When Moving Between Controls on a Form +# Prevent the accidental erasure of data when moving between controls on a form When you tab from one text box or memo field to another in a form, the text in the control is highlighted. This makes it easy for users to accidentally delete the text by pressing a key. By using a few lines of code, you can move the insertion point to the first position in the text box, minimizing the risk of accidentally deleting the text. -To do this, create a procedure for the text box's **[GotFocus](../../../api/Access.TextBox.GotFocus.md)** event. In the **GotFocus** event procedure, set the **[SelLength](../../../api/Access.TextBox.SelLength.md)** property of the text box to its **[SelStart](../../../api/Access.ComboBox.SelStart.md)** property. The following example illustrates how to do this for a text box named **txtFirstName**. - +To do this, create a procedure for the text box's **[GotFocus](../../../api/Access.TextBox.GotFocus.md)** event. In the **GotFocus** event procedure, set the **[SelLength](../../../api/Access.TextBox.SelLength.md)** property of the text box to its **[SelStart](../../../api/Access.ComboBox.SelStart.md)** property. +The following example illustrates how to do this for a text box named **txtFirstName**. ```vb Private Sub txtFirstName_GotFocus() diff --git a/access/Concepts/Controls/refer-to-tab-control-objects-in-vba.md b/access/Concepts/Controls/refer-to-tab-control-objects-in-vba.md index e9376b25b2d..34f7df2b1df 100644 --- a/access/Concepts/Controls/refer-to-tab-control-objects-in-vba.md +++ b/access/Concepts/Controls/refer-to-tab-control-objects-in-vba.md @@ -1,27 +1,23 @@ --- -title: Refer to Tab Control Objects in VBA +title: Refer to tab control objects in VBA ms.prod: access ms.assetid: cf090068-7f0b-7ea6-1565-8a05860f9378 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Refer to Tab Control Objects in VBA +# Refer to tab control objects in VBA You can use a tab control to present several pages of information about a single form. A tab control is useful when your form contains information that can be sorted into two or more categories. -In most ways, a tab control works like other controls on a form and can be referred to as a member of a form's **[Controls](../../../api/Access.Controls.md)** collection. For example, to refer to a tab control named TabControl1 on a form named Form1, you can use the following expression: - - +In most ways, a tab control works like other controls on a form and can be referred to as a member of a form's **[Controls](../../../api/Access.Controls.md)** collection. For example, to refer to a tab control named TabControl1 on a form named Form1, you can use the following expression: ```vb Form1.Controls!TabControl1 ``` -However, because the **Controls** collection is the default collection of the **[Form](../../../api/Access.Form.md)** object, you do not have to explicitly refer to the **Controls** collection. That is, you can omit the reference to the **Controls** collection from the expression, like this: - - +However, because the **Controls** collection is the default collection of the **[Form](../../../api/Access.Form.md)** object, you do not have to explicitly refer to the **Controls** collection. That is, you can omit the reference to the **Controls** collection from the expression, like this: ```vb Form1!TabControl1 @@ -29,37 +25,30 @@ Form1!TabControl1 ``` -## Referring to the Pages Collection - -A tab control contains one or more pages. Each page in a tab control is referenced as a member of the tab control's **[Pages](../../../api/Access.TabControl.Pages.md)** collection. Each page in the **Pages** collection can be referred to by either its **[PageIndex](../../../api/Access.Page.PageIndex.md)** property setting (which reflects the page's position in the collection starting with 0), or by the page's **[Name](../../../api/Access.Page.Name.md)** property setting. There is no default collection for the **[TabControl](../../../api/Access.TabControl.md)** object, so when referring to items in the **Pages** collection by their index value, or to properties of the **Pages** collection, you must explicitly refer to the **Pages** collection. - -For example, to change the value of the **[Caption](../../../api/Access.Page.Caption.md)** property for the first page of a tab control named TabControl1 by referring to its index value in the **Pages** collection, you can use the following statement: +## Refer to the Pages collection +A tab control contains one or more pages. Each page in a tab control is referenced as a member of the tab control's **[Pages](../../../api/Access.TabControl.Pages.md)** collection. Each page in the **Pages** collection can be referred to by either its **[PageIndex](../../../api/Access.Page.PageIndex.md)** property setting (which reflects the page's position in the collection starting with 0), or by the page's **[Name](../../../api/Access.Page.Name.md)** property setting. +There is no default collection for the **[TabControl](../../../api/Access.TabControl.md)** object, so when referring to items in the **Pages** collection by their index value, or to properties of the **Pages** collection, you must explicitly refer to the **Pages** collection. +For example, to change the value of the **[Caption](../../../api/Access.Page.Caption.md)** property for the first page of a tab control named TabControl1 by referring to its index value in the **Pages** collection, you can use the following statement: ```vb TabControl1.Pages(0).Caption = "First Page" ``` -Because each page is a member of the form's **Controls** collection, you can refer to a page solely by its **Name** property without referring to the tab control's name or its **Pages** collection. For example, to change the value of the **Caption** property of a page with its **Name** property set to Page1, use the following statement: - - - +Because each page is a member of the form's **Controls** collection, you can refer to a page solely by its **Name** property without referring to the tab control's name or its **Pages** collection. For example, to change the value of the **Caption** property of a page with its **Name** property set to Page1, use the following statement: ```vb Page1.Caption = "First Page" ``` +> [!NOTE] +> If a user or code changes a page's **PageIndex** property, the reference to the page's index and the page's position in the page order change. In this case, if you want to maintain an absolute reference to a page, refer to the page's **Name** property. - **Note** If a user or code changes a page's **PageIndex** property, the reference to the page's index and the page's position in the page order change. In this case, if you want to maintain an absolute reference to a page, refer to the page's **Name** property. - -The **Pages** collection has one property, **[Count](../../../api/Access.Pages.Count.md)**, that returns the number of pages in a tab control. Note that this property is not a property of the tab control itself, but of its **Pages** collection, so you must explicitly refer to the collection. For example, to determine the number of pages in TabControl1, use the following statement: - - - +The **Pages** collection has one property, **[Count](../../../api/Access.Pages.Count.md)**, that returns the number of pages in a tab control. Note that this property is not a property of the tab control itself, but of its **Pages** collection, so you must explicitly refer to the collection. For example, to determine the number of pages in TabControl1, use the following statement: ```vb TabControl1.Pages.Count @@ -67,68 +56,54 @@ TabControl1.Pages.Count ``` -## Referring to and Changing the Current Page - -A tab control's default property is **[Value](../../../api/Access.TabControl.Value.md)**, which returns an integer that identifies the current page: 0 for the first page, 1 for the second page, and so on. The **Value** property is available only in VBA code or in expressions. By reading the **Value** property at run time, you can determine which page is currently on top. For example, the following statement returns the value for the current page of TabControl1: +## Refer to and change the current page +A tab control's default property is **[Value](../../../api/Access.TabControl.Value.md)**, which returns an integer that identifies the current page: 0 for the first page, 1 for the second page, and so on. The **Value** property is available only in VBA code or in expressions. By reading the **Value** property at run time, you can determine which page is currently on top. For example, the following statement returns the value for the current page of TabControl1: ```vb TabControl1.Value ``` +> [!NOTE] +> Because the **Value** property is the default property for a tab control, you do not have to refer to it explicitly. For this reason, you could omit `.Value` from the preceding example. - **Note** Because the **Value** property is the default property for a tab control, you do not have to refer to it explicitly. For this reason, you could omit `.Value` from the preceding example. - -Setting a tab control's **Value** property at run time changes the focus to the specified page, making it the current page. For example, the following statement moves the focus to the third page of TabControl1: - - - +Setting a tab control's **Value** property at run time changes the focus to the specified page, making it the current page. For example, the following statement moves the focus to the third page of TabControl1: ```vb TabControl1 = 2 ``` -This is useful if you set a tab control's **[Style](../../../api/Access.TabControl.Style.md)** property to None (which displays no tabs) and want to use command buttons on the form to determine which page has the focus. To use a command button to display a page, add an event procedure to the button's **[OnClick](../../../api/Access.CommandButton.OnClick.md)** event that sets the tab control's **Value** property to the integer that identifies the appropriate page. - -By using the **Value** property with the **Pages** collection, you can set properties at run time for the page that is on top. For example, you can hide the current page and all of its controls by setting the page's **[Visible](../../../api/Access.Page.Visible.md)** property to **False**. The following statement hides the current page of TabControl1: - - +This is useful if you set a tab control's **[Style](../../../api/Access.TabControl.Style.md)** property to **None** (which displays no tabs) and want to use command buttons on the form to determine which page has the focus. To use a command button to display a page, add an event procedure to the button's **[OnClick](../../../api/Access.CommandButton.OnClick.md)** event that sets the tab control's **Value** property to the integer that identifies the appropriate page. +By using the **Value** property with the **Pages** collection, you can set properties at run time for the page that is on top. For example, you can hide the current page and all of its controls by setting the page's **[Visible](../../../api/Access.Page.Visible.md)** property to **False**. The following statement hides the current page of TabControl1: ```vb TabControl1.Pages(TabControl1).Visible = False ``` -Each page in a tab control also has a **PageIndex** property that specifies the position of a page within the **Pages** collection using the same numbering sequence as the tab control's **Value** property: 0 for the first page, 1 for the second page, and so on. Setting the value of a page's **PageIndex** property changes the order in which pages appear in the tab control. For example, if you wanted to make a page named Page1 the second page, you'd use the following statement: - - - +Each page in a tab control also has a **PageIndex** property that specifies the position of a page within the **Pages** collection by using the same numbering sequence as the tab control's **Value** property: 0 for the first page, 1 for the second page, and so on. Setting the value of a page's **PageIndex** property changes the order in which pages appear in the tab control. For example, if you wanted to make a page named Page1 the second page, you'd use the following statement: ```vb Page1.PageIndex = 1 ``` -The **PageIndex** property is more typically set at design time in a page's property sheet. You can also set the page order by right-clicking the border of a tab control and then clicking **Page Order** on the shortcut menu. +The **PageIndex** property is more typically set at design time in a page's property sheet. You can also set the page order by right-clicking the border of a tab control, and then clicking **Page Order** on the shortcut menu. -## Referring to Controls on a Tab Control Page +## Refer to controls on a tab control page The controls you place on a tab control page are part of the same collection as all controls on the form. For this reason, each control on a tab control page must have a name that is unique with respect to all other controls on the same form. You can refer to controls on a tab control page by using the same syntax for controls on a form without a tab control. - ```vb Forms!Employees!HomePhone ``` -Because each control on a form has its own **Controls** collection, you can also refer to the controls on a tab control as members of its **Controls** collection. For example, the following code enumerates (lists) all the controls on the tab control of the Employees form. - - - +Because each control on a form has its own **Controls** collection, you can also refer to the controls on a tab control as members of its **Controls** collection. For example, the following code enumerates (lists) all the controls on the tab control of the Employees form. ```vb Sub ListTabControlControls() @@ -156,9 +131,9 @@ ErrorHandler: End Sub ``` -Additionally, each page on a tab control has its own **Controls** collection. By using a page's **Controls** collection, you can refer to controls on each page. The following code enumerates the controls for each page of the tab control on the Employees form. - +
+Additionally, each page on a tab control has its own **Controls** collection. By using a page's **Controls** collection, you can refer to controls on each page. The following code enumerates the controls for each page of the tab control on the Employees form. ```vb diff --git a/access/Concepts/Criteria-Expressions/avg-function-microsoft-access-sql.md b/access/Concepts/Criteria-Expressions/avg-function-microsoft-access-sql.md index 880ec493e85..d5b5ffe8c60 100644 --- a/access/Concepts/Criteria-Expressions/avg-function-microsoft-access-sql.md +++ b/access/Concepts/Criteria-Expressions/avg-function-microsoft-access-sql.md @@ -1,22 +1,21 @@ --- -title: Avg Function (Microsoft Access SQL) +title: Avg function (Microsoft Access SQL) keywords: jetsql40.chm5278823 f1_keywords: - jetsql40.chm5278823 ms.prod: access ms.assetid: be955493-a236-2dbe-a08d-2a7f6d113b39 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Avg Function (Microsoft Access SQL) +# Avg function (Microsoft Access SQL) **Applies to:** Access 2013 | Access 2016 Calculates the arithmetic mean of a set of values contained in a specified field on a query. ## Syntax - **Avg(** _expr_ **)** @@ -24,17 +23,15 @@ The _expr_ placeholder represents a string expression identifying the field tha ## Remarks - -The average calculated by **Avg** is the arithmetic mean (the sum of the values divided by the number of values). You could use **Avg**, for example, to calculate average freight cost. +The average calculated by **Avg** is the arithmetic mean (the sum of the values divided by the number of values). You could use **Avg**, for example, to calculate average freight cost. -The **Avg** function does not include any **Null** fields in the calculation. +The **Avg** function does not include any **Null** fields in the calculation. -You can use **Avg** in a query expression and in the **SQL** property of a **QueryDef** object or when creating a Recordset object based on an SQL query. +You can use **Avg** in a query expression and in the **SQL** property of a **QueryDef** object or when creating a Recordset object based on an SQL query. ## Example - This example uses the Orders table to calculate the average freight charges for orders with freight charges over $100. @@ -70,12 +67,9 @@ End Sub ## See also -- [Access for developers forum on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev)
-- [Access help on support.office.com](https://support.office.com/search/results?query=Access)
-- [Access help on answers.microsoft.com](https://answers.microsoft.com/en-us/office/forum/access?page=1&;tab=question&;status=all&;auth=1)
-- [Search for specific Access error codes on Bing](https://www.bing.com/)
-- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access wiki on UtterAcess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/)
+- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) - [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) diff --git a/access/Concepts/Criteria-Expressions/calculate-fields-in-domain-aggregate-functions.md b/access/Concepts/Criteria-Expressions/calculate-fields-in-domain-aggregate-functions.md index 35bdea1dd0a..f7ffd324113 100644 --- a/access/Concepts/Criteria-Expressions/calculate-fields-in-domain-aggregate-functions.md +++ b/access/Concepts/Criteria-Expressions/calculate-fields-in-domain-aggregate-functions.md @@ -1,15 +1,15 @@ --- -title: Calculate Fields in Domain Aggregate Functions +title: Calculate fields in domain aggregate functions keywords: vbaac10.chm5187048 f1_keywords: - vbaac10.chm5187048 ms.prod: access ms.assetid: 73c27d1c-0a3c-03e4-c17c-337133d7b316 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Calculate Fields in Domain Aggregate Functions +# Calculate fields in domain aggregate functions You can use the string expression argument (the _expr_ argument) in a domain aggregate function to perform a calculation on values in a field. For example, you can calculate a percentage (such as a surcharge or sales tax) by dividing a field value by a number. @@ -26,9 +26,8 @@ The following table provides examples of calculations on fields from an Orders t |Subtract one field from another|"[ReorderLevel] - [UnitsInStock]"| You would most likely use a domain aggregate function in a macro or module, in a calculated control on a form or report, or in a criteria expression in a query. -For example, you can calculate the average discount amount for all orders in an Order Details table. Multiply the Unit Price and Discount fields to determine the discount for each order, then calculate the average. Enter the following example in a procedure in a module. - +For example, you can calculate the average discount amount for all orders in an Order Details table. Multiply the Unit Price and Discount fields to determine the discount for each order, and then calculate the average. Enter the following example in a procedure in a module. ```vb Dim dblX As Double diff --git a/access/Concepts/Criteria-Expressions/count-function-microsoft-access-sql.md b/access/Concepts/Criteria-Expressions/count-function-microsoft-access-sql.md index 52aa1710932..cec59145f4b 100644 --- a/access/Concepts/Criteria-Expressions/count-function-microsoft-access-sql.md +++ b/access/Concepts/Criteria-Expressions/count-function-microsoft-access-sql.md @@ -1,36 +1,35 @@ --- -title: Count Function (Microsoft Access SQL) +title: Count function (Microsoft Access SQL) keywords: jetsql40.chm5278824 f1_keywords: - jetsql40.chm5278824 ms.prod: access ms.assetid: 01743d33-d7de-12b5-eb0f-eb775b0bcffd -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Count Function (Microsoft Access SQL) +# Count function (Microsoft Access SQL) **Applies to:** Access 2013 | Access 2016 Calculates the number of records returned by a query. ## Syntax - **Count(** _expr_ **)** The _expr_ placeholder represents a string expression identifying the field that contains the data you want to count or an expression that performs a calculation using the data in the field. Operands in _expr_ can include the name of a table field or function (which can be either intrinsic or user-defined but not other SQL aggregate functions). You can count any kind of data, including text. - ## Remarks - -You can use **Count** to count the number of records in an underlying query. For example, you could use **Count** to count the number of orders shipped to a particular country or region. +You can use **Count** to count the number of records in an underlying query. For example, you could use **Count** to count the number of orders shipped to a particular country or region. Although _expr_ can perform a calculation on a field, **Count** simply tallies the number of records. It does not matter what values are stored in the records. -The **Count** function does not count records that have **Null** fields unless _expr_ is the asterisk (*) wildcard character. If you use an asterisk, **Count** calculates the total number of records, including those that contain **Null** fields. **Count(** * **)** is considerably faster than **Count(** [ _Column Name_ ] **)**. Do not enclose the asterisk in quotation marks (' '). The following example calculates the number of records in the Orders table: +The **Count** function does not count records that have **Null** fields unless _expr_ is the asterisk (*) wildcard character. If you use an asterisk, **Count** calculates the total number of records, including those that contain **Null** fields. **Count(** * **)** is considerably faster than **Count(** [ _Column Name_ ] **)**. Do not enclose the asterisk in quotation marks (' '). + +The following example calculates the number of records in the Orders table: ```sql SELECT Count(*) @@ -45,11 +44,10 @@ Count('ShippedDate & Freight') AS [Not Null] FROM Orders; ``` -You can use **Count** in a query expression. You can also use this expression in the **SQL** property of a **QueryDef** object or when creating a **Recordset** object based on an SQL query. +You can use **Count** in a query expression. You can also use this expression in the **SQL** property of a **QueryDef** object or when creating a **Recordset** object based on an SQL query. ## Example - This example uses the Orders table to calculate the number of orders shipped to the United Kingdom. @@ -87,12 +85,8 @@ End Sub ## See also -- [Access for developers forum on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) - [Access help on support.office.com](https://support.office.com/search/results?query=Access) -- [Access help on answers.microsoft.com](https://answers.microsoft.com/en-us/office/forum/access?page=1&;tab=question&;status=all&;auth=1) -- [Search for specific Access error codes on Bing](https://www.bing.com/) - [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) -- [Access wiki on UtterAcess](https://www.utteraccess.com/forum/index.php?act=idx) - [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) -- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) - +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) \ No newline at end of file diff --git a/access/Concepts/Criteria-Expressions/date-and-time-criteria-expressions.md b/access/Concepts/Criteria-Expressions/date-and-time-criteria-expressions.md index 817f47a6319..3329f73c5d6 100644 --- a/access/Concepts/Criteria-Expressions/date-and-time-criteria-expressions.md +++ b/access/Concepts/Criteria-Expressions/date-and-time-criteria-expressions.md @@ -1,25 +1,22 @@ --- -title: Date and Time Criteria Expressions +title: Date and time criteria expressions keywords: vbaac10.chm10885 f1_keywords: - vbaac10.chm10885 ms.prod: access ms.assetid: fff89f87-444e-b275-c7b1-4c82240e57f0 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Date and Time Criteria Expressions +# Date and time criteria expressions To specify date or time criteria for an operation, you supply a date or time value as part of the string expression that forms the _criteria_ argument. This value must be enclosed in number signs (#). +> [!NOTE] +> The number signs indicate to Access that the _criteria_ argument contains a date or time within a string. - **Note** The number signs indicate to Access that the _criteria_ argument contains a date or time within a string. - - -Suppose that you are creating a filter for an Employees form to display records for all employees born on or after January 1, 1960. You could construct the _criteria_ argument for the form's **Filter** or **ServerFilter** property as in the following example. Note the placement of the number signs. - - +Suppose that you are creating a filter for an Employees form to display records for all employees born on or after January 1, 1960. You could construct the _criteria_ argument for the form's **[Filter](../../../api/Access.Form.Filter(property).md)** or **[ServerFilter](../../../api/Access.Form.ServerFilter.md)** property as in the following example. Note the placement of the number signs. ```vb diff --git a/access/Concepts/Criteria-Expressions/date-and-time-criteria-from-a-control-on-a-form.md b/access/Concepts/Criteria-Expressions/date-and-time-criteria-from-a-control-on-a-form.md index 04a5ceefb8d..914f6975473 100644 --- a/access/Concepts/Criteria-Expressions/date-and-time-criteria-from-a-control-on-a-form.md +++ b/access/Concepts/Criteria-Expressions/date-and-time-criteria-from-a-control-on-a-form.md @@ -1,15 +1,15 @@ --- -title: Date and Time Criteria from a Control on a Form +title: Date and time criteria from a control on a form keywords: vbaac10.chm5187147 f1_keywords: - vbaac10.chm5187147 ms.prod: access ms.assetid: 132cf297-eb3b-68a1-7a47-b832931a5091 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Date and Time Criteria from a Control on a Form +# Date and time criteria from a control on a form If you want to change the _criteria_ argument for an operation based on a user's decision, you can specify that the criteria comes from a control on a form. For example, you could specify that the _criteria_ argument comes from a list box containing order dates from an Orders table. @@ -17,12 +17,10 @@ To specify date and time criteria that comes from a control on a form, you inclu In addition to enclosing the entire string expression in double quotation marks ("), you must also ensure that the date or time criteria within the string expression is enclosed in number signs (#). The number signs must be included in the strings flanking the expression that references the control on the form. +> [!NOTE] +> The number signs indicate to Access that the _criteria_ argument contains a date or time within a string. - **Note** The number signs indicate to Access that the _criteria_ argument contains a date or time within a string. - -The following examples set a form's **Filter** or **ServerFilter** property based on criteria that comes from a control named HireDate that's on the form. Note the placement of the number signs. - - +The following examples set a form's **[Filter](../../../api/Access.Form.Filter(property).md)** or **[ServerFilter](../../../api/Access.Form.ServerFilter.md)** property based on criteria that comes from a control named HireDate that's on the form. Note the placement of the number signs. ```vb Forms!Employees.Filter = "[HireDate] >= #" _ @@ -30,9 +28,6 @@ Forms!Employees.Filter = "[HireDate] >= #" _ Forms!Employees.FilterOn = True ``` -- or - - - ```vb Forms!Employees.ServerFilter = "[HireDate] >= #" _ @@ -40,21 +35,19 @@ Forms!Employees.ServerFilter = "[HireDate] >= #" _ Forms!Employees.FilterOn = True ``` -If the current value of the HireDate control is , the **Filter** or **ServerFilter** property will have the following _criteria_ argument: - +If the current value of the HireDate control is May 1, 1992, the **Filter** or **ServerFilter** property will have the following _criteria_ argument: ```text "[HireDate] >= #5-1-92#" ``` - - **Tip** To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. +> [!TIP] +> To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. You can also include a variable representing a date or time in the _criteria_ argument. The variable should be separate from the string expression, so that Access will evaluate the variable first and then concatenate it with the rest of the string expression. The date or time criteria must be enclosed in number signs. -The following example shows how to construct a _criteria_ argument that includes a variable representing a date or time: - +The following example shows how to construct a _criteria_ argument that includes a variable representing a date or time: ```vb Dim datHireDate As Date diff --git a/access/Concepts/Criteria-Expressions/functions-alphabetical-list.md b/access/Concepts/Criteria-Expressions/functions-alphabetical-list.md index 8ebbf8437ef..15714cbc019 100644 --- a/access/Concepts/Criteria-Expressions/functions-alphabetical-list.md +++ b/access/Concepts/Criteria-Expressions/functions-alphabetical-list.md @@ -1,348 +1,346 @@ --- -title: Functions (Alphabetical List) +title: Functions (alphabetical list) ms.prod: access ms.assetid: c32092f7-cac1-5c29-956d-20e09506cb16 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Functions (Alphabetical List) +# Functions (alphabetical list) The following topics describe common functions used in Access expressions. - ## Common Access expression functions -[Abs Function ](../../../language/reference/User-Interface-Help/abs-function.md) - -[Array Function ](../../../language/reference/User-Interface-Help/array-function.md) +- [Abs function](../../../language/reference/User-Interface-Help/abs-function.md) +- [Array function](../../../language/reference/User-Interface-Help/array-function.md) +- [Asc function](../../../language/reference/User-Interface-Help/asc-function.md) +- [Atn function](../../../language/reference/User-Interface-Help/atn-function.md) +- [Avg function](avg-function-microsoft-access-sql.md) +- [CallByName function](../../../language/reference/User-Interface-Help/callbyname-function.md) +- [CBool function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CByte function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CCur function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CDate function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CDbl function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CDec function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [Choose function](../../../language/reference/User-Interface-Help/choose-function.md) +- [Chr function](../../../language/reference/User-Interface-Help/chr-function.md) +- [CInt function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CLng function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [Command function](../../../language/reference/User-Interface-Help/command-function.md) +- [Cos function](../../../language/reference/User-Interface-Help/cos-function.md) +- [Count function](count-function-microsoft-access-sql.md) +- [CreateObject function](../../../language/reference/User-Interface-Help/createobject-function.md) +- [CSng function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CStr function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CurDir function](../../../language/reference/User-Interface-Help/curdir-function.md) +- [CurrentUser method](../../../api/Access.Application.CurrentUser.md) +- [CVar function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CVErr function](../../../language/reference/User-Interface-Help/cverr-function.md) +- [Date function](../../../language/reference/User-Interface-Help/date-function.md) +- [DateAdd function](../../../language/reference/User-Interface-Help/dateadd-function.md) +- [DateDiff function](../../../language/reference/User-Interface-Help/datediff-function.md) +- [DatePart function](../../../language/reference/User-Interface-Help/datepart-function.md) +- [DateSerial function](../../../language/reference/User-Interface-Help/dateserial-function.md) +- [DateValue function](../../../language/reference/User-Interface-Help/datevalue-function.md) +- [DAvg function](../../../api/Access.application.davg.md) +- [Day function](../../../language/reference/User-Interface-Help/day-function.md) +- [DCount method](../../../api/Access.Application.DCount.md) +- [DDB function](../../../language/reference/User-Interface-Help/ddb-function.md) +- [DDEInitiate method](../../../api/Access.Application.DDEInitiate.md) +- [DDERequest method](../../../api/Access.Application.DDERequest.md) +- [DFirst method](../../../api/Access.Application.DFirst.md) +- [Dir function](../../../language/reference/User-Interface-Help/dir-function.md) +- [DLast method](../../../api/Access.Application.DLast.md) +- [DLookup method](../../../api/Access.Application.DLookup.md) +- [DMax method](../../../api/Access.Application.DMax.md) +- [DMin method](../../../api/Access.Application.DMin.md) +- [DoEvents function](../../../language/reference/User-Interface-Help/doevents-function.md) +- [DStDev method](../../../api/Access.Application.DStDev.md) +- [DStDevP method](../../../api/Access.Application.DStDevP.md) +- [DSum method](../../../api/Access.Application.DSum.md) +- [DVar method](../../../api/Access.Application.DVar.md) +- [DVarP method](../../../api/Access.Application.DVarP.md) +- [Environ function](../../../language/reference/User-Interface-Help/environ-function.md) +- [EOF function](../../../language/reference/User-Interface-Help/eof-function.md) +- [Error function](../../../language/reference/User-Interface-Help/error-function.md) +- [EuroConvert method](../../../api/Access.Application.EuroConvert.md) +- [Eval method](../../../api/Access.Application.Eval.md) +- [Exp function](../../../language/reference/User-Interface-Help/exp-function.md) +- [FileAttr function](../../../language/reference/User-Interface-Help/fileattr-function.md) +- [FileDateTime function](../../../language/reference/User-Interface-Help/filedatetime-function.md) +- [FileLen function](../../../language/reference/User-Interface-Help/filelen-function.md) +- [Filter function](../../../language/reference/User-Interface-Help/filter-function.md) +- [Fix function](../../../language/reference/User-Interface-Help/int-fix-functions.md) +- [Format function](../../../language/reference/User-Interface-Help/format-function-visual-basic-for-applications.md) +- [FormatCurrency function](../../../language/reference/User-Interface-Help/formatcurrency-function.md) +- [FormatDateTime function](../../../language/reference/User-Interface-Help/formatdatetime-function.md) +- [FormatNumber function](../../../language/reference/User-Interface-Help/formatnumber-function.md) +- [FormatPercent function](../../../language/reference/User-Interface-Help/formatpercent-function.md) +- [FreeFile function](../../../language/reference/User-Interface-Help/freefile-function.md) +- [FV function](../../../language/reference/User-Interface-Help/fv-function.md) +- [GetAllSettings function](../../../language/reference/User-Interface-Help/getallsettings-function.md) +- [GetAttr function](../../../language/reference/User-Interface-Help/getattr-function.md) +- [GetObject function](../../../language/reference/User-Interface-Help/getobject-function.md) +- [GetSetting function](../../../language/reference/User-Interface-Help/getsetting-function.md) +- [GUIDFromString method](../../../api/Access.Application.GUIDFromString.md) +- [Hex function](../../../language/reference/User-Interface-Help/hex-function.md) +- [Hour function](../../../language/reference/User-Interface-Help/hour-function.md) +- [HtmlEncode method](../../../api/Access.Application.HtmlEncode.md) +- [HyperlinkPart method](../../../api/Access.Application.HyperlinkPart.md) +- [IIf function](../../../language/reference/User-Interface-Help/iif-function.md) +- [IMEStatus function](../../../language/reference/User-Interface-Help/imestatus-function.md) +- [Input function](../../../language/reference/User-Interface-Help/input-function.md) +- [InputBox function](../../../language/reference/User-Interface-Help/inputbox-function.md) +- [InStr function](../../../language/reference/User-Interface-Help/instr-function.md) +- [InStrRev function](../../../language/reference/User-Interface-Help/instrrev-function.md) +- [Int function](../../../language/reference/User-Interface-Help/int-fix-functions.md) +- [IPmt function](../../../language/reference/User-Interface-Help/ipmt-function.md) +- [IRR function](../../../language/reference/User-Interface-Help/irr-function.md) +- [IsArray function](../../../language/reference/User-Interface-Help/isarray-function.md) +- [IsDate function](../../../language/reference/User-Interface-Help/isdate-function.md) +- [IsEmpty function](../../../language/reference/User-Interface-Help/isempty-function.md) +- [IsError function](../../../language/reference/User-Interface-Help/iserror-function.md) +- [IsMissing function](../../../language/reference/User-Interface-Help/ismissing-function.md) +- [IsNull function](../../../language/reference/User-Interface-Help/isnull-function.md) +- [IsNumeric function](../../../language/reference/User-Interface-Help/isnumeric-function.md) +- [IsObject function](../../../language/reference/User-Interface-Help/isobject-function.md) +- [Join function](../../../language/reference/User-Interface-Help/join-function.md) +- [LBound function](../../../language/reference/User-Interface-Help/lbound-function.md) +- [LCase function](../../../language/reference/User-Interface-Help/lcase-function.md) +- [Left function](../../../language/reference/User-Interface-Help/left-function.md) +- [Len function](../../../language/reference/User-Interface-Help/len-function.md) +- [Loc function](../../../language/reference/User-Interface-Help/loc-function.md) +- [LOF function](../../../language/reference/User-Interface-Help/lof-function.md) +- [Log function](../../../language/reference/User-Interface-Help/log-function.md) +- [LTrim function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) +- [Max function](min-max-functions-microsoft-access-sql.md) +- [Mid function](../../../language/reference/User-Interface-Help/mid-function.md) +- [Min function](min-max-functions-microsoft-access-sql.md) +- [Minute function](../../../language/reference/User-Interface-Help/minute-function.md) +- [MIRR function](../../../language/reference/User-Interface-Help/mirr-function.md) +- [Month function](../../../language/reference/User-Interface-Help/month-function.md) +- [MonthName function](../../../language/reference/User-Interface-Help/monthname-function.md) +- [MsgBox function](../../../language/reference/User-Interface-Help/msgbox-function.md) +- [Now function](../../../language/reference/User-Interface-Help/now-function.md) +- [NPer function](../../../language/reference/User-Interface-Help/nper-function.md) +- [NPV function](../../../language/reference/User-Interface-Help/npv-function.md) +- [Nz method](../../../api/Access.Application.Nz.md) +- [Oct function](../../../language/reference/User-Interface-Help/oct-function.md) +- [Partition function](../../../language/reference/User-Interface-Help/partition-function.md) +- [PlainText method](../../../api/Access.Application.PlainText.md) +- [Pmt function](../../../language/reference/User-Interface-Help/pmt-function.md) +- [PPmt function](../../../language/reference/User-Interface-Help/ppmt-function.md) +- [PV function](../../../language/reference/User-Interface-Help/pv-function.md) +- [QBColor function](../../../language/reference/User-Interface-Help/qbcolor-function.md) +- [Rate function](../../../language/reference/User-Interface-Help/rate-function.md) +- [Replace function](../../../language/reference/User-Interface-Help/replace-function.md) +- [RGB function](../../../language/reference/User-Interface-Help/rgb-function.md) +- [Right function](../../../language/reference/User-Interface-Help/right-function.md) +- [Rnd function](../../../language/reference/User-Interface-Help/rnd-function.md) +- [Round function](../../../language/reference/User-Interface-Help/round-function.md) +- [RTrim function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) +- [Second function](../../../language/reference/User-Interface-Help/second-function.md) +- [Seek function](../../../language/reference/User-Interface-Help/seek-function.md) +- [Sgn function](../../../language/reference/User-Interface-Help/sgn-function.md) +- [Shell function](../../../language/reference/User-Interface-Help/shell-function.md) +- [Sin function](../../../language/reference/User-Interface-Help/sin-function.md) +- [SLN function](../../../language/reference/User-Interface-Help/sln-function.md) +- [Space function](../../../language/reference/User-Interface-Help/space-function.md) +- [Spc function](../../../language/reference/User-Interface-Help/spc-function.md) +- [Split function](../../../language/reference/User-Interface-Help/split-function.md) +- [Sqr function](../../../language/reference/User-Interface-Help/sqr-function.md) +- [StDev function](stdev-stdevp-functions-microsoft-access-sql.md) +- [StDevP function](stdev-stdevp-functions-microsoft-access-sql.md) +- [Str function](../../../language/reference/User-Interface-Help/str-function.md) +- [StrComp function](../../../language/reference/User-Interface-Help/strcomp-function.md) +- [StrConv function](../../../language/reference/User-Interface-Help/strconv-function.md) +- [String function](../../../language/reference/User-Interface-Help/string-function.md) +- [StringFromGUID method](../../../api/Access.Application.StringFromGUID.md) +- [StrReverse function](../../../language/reference/User-Interface-Help/strreverse-function.md) +- [Sum function](sum-function-microsoft-access-sql.md) +- [Switch function](../../../language/reference/User-Interface-Help/switch-function.md) +- [SYD function](../../../language/reference/User-Interface-Help/syd-function.md) +- [Tab function](../../../language/reference/User-Interface-Help/tab-function.md) +- [Tan function](../../../language/reference/User-Interface-Help/tan-function.md) +- [Time function](../../../language/reference/User-Interface-Help/time-function.md) +- [Timer function](../../../language/reference/User-Interface-Help/timer-function.md) +- [TimeSerial function](../../../language/reference/User-Interface-Help/timeserial-function.md) +- [TimeValue function](../../../language/reference/User-Interface-Help/timevalue-function.md) +- [Trim function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) +- [TypeName function](../../../language/reference/User-Interface-Help/typename-function.md) +- [UBound function](../../../language/reference/User-Interface-Help/ubound-function.md) +- [UCase function](../../../language/reference/User-Interface-Help/ucase-function.md) +- [Val function](../../../language/reference/User-Interface-Help/val-function.md) +- [Var, VarP functions](var-varp-functions-microsoft-access-sql.md) +- [VarType function](../../../language/reference/User-Interface-Help/vartype-function.md) +- [Weekday function](../../../language/reference/User-Interface-Help/weekday-function.md) +- [WeekdayName function](../../../language/reference/User-Interface-Help/weekdayname-function.md) +- [Year function](../../../language/reference/User-Interface-Help/year-function.md) -[Asc Function](../../../language/reference/User-Interface-Help/asc-function.md) -[Atn Function](../../../language/reference/User-Interface-Help/atn-function.md) -[Avg Function](avg-function-microsoft-access-sql.md) -[CallByName Function](../../../language/reference/User-Interface-Help/callbyname-function.md) -[CBool Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CByte Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CCur Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CDate Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CDbl Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CDec Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[Choose Function](../../../language/reference/User-Interface-Help/choose-function.md) -[Chr Function](../../../language/reference/User-Interface-Help/chr-function.md) -[CInt Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CLng Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[Command Function](../../../language/reference/User-Interface-Help/command-function.md) -[Cos Function](../../../language/reference/User-Interface-Help/cos-function.md) -[Count Function](count-function-microsoft-access-sql.md) -[CreateObject Function](../../../language/reference/User-Interface-Help/createobject-function.md) -[CSng Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CStr Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CurDir Function](../../../language/reference/User-Interface-Help/curdir-function.md) -[CurrentUser Method](../../../api/Access.Application.CurrentUser.md) -[CVar Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) -[CVErr Function](../../../language/reference/User-Interface-Help/cverr-function.md) -[Date Function](../../../language/reference/User-Interface-Help/date-function.md) -[DateAdd Function](../../../language/reference/User-Interface-Help/dateadd-function.md) -[DateDiff Function](../../../language/reference/User-Interface-Help/datediff-function.md) -[DatePart Function](../../../language/reference/User-Interface-Help/datepart-function.md) -[DateSerial Function](../../../language/reference/User-Interface-Help/dateserial-function.md) -[DateValue Function](../../../language/reference/User-Interface-Help/datevalue-function.md) -[DAvg Function](../../../api/Access.application.davg.md) -[Day Function](../../../language/reference/User-Interface-Help/day-function.md) -[DCount Method](../../../api/Access.Application.DCount.md) -[DDB Function](../../../language/reference/User-Interface-Help/ddb-function.md) -[DDEInitiate Method](../../../api/Access.Application.DDEInitiate.md) -[DDERequest Method](../../../api/Access.Application.DDERequest.md) -[DFirst Method](../../../api/Access.Application.DFirst.md) -[Dir Function](../../../language/reference/User-Interface-Help/dir-function.md) -[DLast Method](../../../api/Access.Application.DLast.md) -[DLookup Method](../../../api/Access.Application.DLookup.md) -[DMax Method](../../../api/Access.Application.DMax.md) -[DMin Method](../../../api/Access.Application.DMin.md) -[DoEvents Function](../../../language/reference/User-Interface-Help/doevents-function.md) -[DStDev Method](../../../api/Access.Application.DStDev.md) -[DStDevP Method](../../../api/Access.Application.DStDevP.md) -[DSum Method](../../../api/Access.Application.DSum.md) -[DVar Method](../../../api/Access.Application.DVar.md) -[DVarP Method](../../../api/Access.Application.DVarP.md) -[Environ Function](../../../language/reference/User-Interface-Help/environ-function.md) -[EOF Function](../../../language/reference/User-Interface-Help/eof-function.md) -[Error Function](../../../language/reference/User-Interface-Help/error-function.md) -[EuroConvert Method](../../../api/Access.Application.EuroConvert.md) -[Eval Method](../../../api/Access.Application.Eval.md) -[Exp Function](../../../language/reference/User-Interface-Help/exp-function.md) -[FileAttr Function](../../../language/reference/User-Interface-Help/fileattr-function.md) -[FileDateTime Function](../../../language/reference/User-Interface-Help/filedatetime-function.md) -[FileLen Function](../../../language/reference/User-Interface-Help/filelen-function.md) -[Filter Function](../../../language/reference/User-Interface-Help/filter-function.md) -[Fix Function](../../../language/reference/User-Interface-Help/int-fix-functions.md) -[Format Function](../../../language/reference/User-Interface-Help/format-function-visual-basic-for-applications.md) -[FormatCurrency Function](../../../language/reference/User-Interface-Help/formatcurrency-function.md) -[FormatDateTime Function](../../../language/reference/User-Interface-Help/formatdatetime-function.md) -[FormatNumber Function](../../../language/reference/User-Interface-Help/formatnumber-function.md) -[FormatPercent Function](../../../language/reference/User-Interface-Help/formatpercent-function.md) -[FreeFile Function](../../../language/reference/User-Interface-Help/freefile-function.md) -[FV Function](../../../language/reference/User-Interface-Help/fv-function.md) -[GetAllSettings Function](../../../language/reference/User-Interface-Help/getallsettings-function.md) -[GetAttr Function](../../../language/reference/User-Interface-Help/getattr-function.md) -[GetObject Function](../../../language/reference/User-Interface-Help/getobject-function.md) -[GetSetting Function](../../../language/reference/User-Interface-Help/getsetting-function.md) -[GUIDFromString Method](../../../api/Access.Application.GUIDFromString.md) -[Hex Function](../../../language/reference/User-Interface-Help/hex-function.md) -[Hour Function](../../../language/reference/User-Interface-Help/hour-function.md) -[HtmlEncode Method](../../../api/Access.Application.HtmlEncode.md) -[HyperlinkPart Method](../../../api/Access.Application.HyperlinkPart.md) -[IIf Function](../../../language/reference/User-Interface-Help/iif-function.md) -[IMEStatus Function](../../../language/reference/User-Interface-Help/imestatus-function.md) -[Input Function](../../../language/reference/User-Interface-Help/input-function.md) -[InputBox Function](../../../language/reference/User-Interface-Help/inputbox-function.md) -[InStr Function](../../../language/reference/User-Interface-Help/instr-function.md) -[InStrRev Function](../../../language/reference/User-Interface-Help/instrrev-function.md) -[Int Function](../../../language/reference/User-Interface-Help/int-fix-functions.md) -[IPmt Function](../../../language/reference/User-Interface-Help/ipmt-function.md) -[IRR Function](../../../language/reference/User-Interface-Help/irr-function.md) -[IsArray Function](../../../language/reference/User-Interface-Help/isarray-function.md) -[IsDate Function](../../../language/reference/User-Interface-Help/isdate-function.md) -[IsEmpty Function](../../../language/reference/User-Interface-Help/isempty-function.md) -[IsError Function](../../../language/reference/User-Interface-Help/iserror-function.md) -[IsMissing Function](../../../language/reference/User-Interface-Help/ismissing-function.md) -[IsNull Function](../../../language/reference/User-Interface-Help/isnull-function.md) -[IsNumeric Function](../../../language/reference/User-Interface-Help/isnumeric-function.md) -[IsObject Function](../../../language/reference/User-Interface-Help/isobject-function.md) -[Join Function](../../../language/reference/User-Interface-Help/join-function.md) -[LBound Function](../../../language/reference/User-Interface-Help/lbound-function.md) -[LCase Function](../../../language/reference/User-Interface-Help/lcase-function.md) -[Left Function](../../../language/reference/User-Interface-Help/left-function.md) -[Len Function](../../../language/reference/User-Interface-Help/len-function.md) -[Loc Function](../../../language/reference/User-Interface-Help/loc-function.md) -[LOF Function](../../../language/reference/User-Interface-Help/lof-function.md) -[Log Function](../../../language/reference/User-Interface-Help/log-function.md) -[LTrim Function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) -[Max Function](min-max-functions-microsoft-access-sql.md) -[Mid Function](../../../language/reference/User-Interface-Help/mid-function.md) -[Min Function](min-max-functions-microsoft-access-sql.md) -[Minute Function](../../../language/reference/User-Interface-Help/minute-function.md) -[MIRR Function](../../../language/reference/User-Interface-Help/mirr-function.md) -[Month Function](../../../language/reference/User-Interface-Help/month-function.md) -[MonthName Function](../../../language/reference/User-Interface-Help/monthname-function.md) -[MsgBox Function](../../../language/reference/User-Interface-Help/msgbox-function.md) -[Now Function](../../../language/reference/User-Interface-Help/now-function.md) -[NPer Function](../../../language/reference/User-Interface-Help/nper-function.md) -[NPV Function](../../../language/reference/User-Interface-Help/npv-function.md) -[Nz Method](../../../api/Access.Application.Nz.md) -[Oct Function](../../../language/reference/User-Interface-Help/oct-function.md) -[Partition Function](../../../language/reference/User-Interface-Help/partition-function.md) -[PlainText Method](../../../api/Access.Application.PlainText.md) -[Pmt Function](../../../language/reference/User-Interface-Help/pmt-function.md) -[PPmt Function](../../../language/reference/User-Interface-Help/ppmt-function.md) -[PV Function](../../../language/reference/User-Interface-Help/pv-function.md) -[QBColor Function](../../../language/reference/User-Interface-Help/qbcolor-function.md) -[Rate Function](../../../language/reference/User-Interface-Help/rate-function.md) -[Replace Function](../../../language/reference/User-Interface-Help/replace-function.md) -[RGB Function](../../../language/reference/User-Interface-Help/rgb-function.md) -[Right Function](../../../language/reference/User-Interface-Help/right-function.md) -[Rnd Function](../../../language/reference/User-Interface-Help/rnd-function.md) -[Round Function](../../../language/reference/User-Interface-Help/round-function.md) -[RTrim Function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) -[Second Function](../../../language/reference/User-Interface-Help/second-function.md) -[Seek Function](../../../language/reference/User-Interface-Help/seek-function.md) -[Sgn Function](../../../language/reference/User-Interface-Help/sgn-function.md) -[Shell Function](../../../language/reference/User-Interface-Help/shell-function.md) -[Sin Function](../../../language/reference/User-Interface-Help/sin-function.md) -[SLN Function](../../../language/reference/User-Interface-Help/sln-function.md) -[Space Function](../../../language/reference/User-Interface-Help/space-function.md) -[Spc Function](../../../language/reference/User-Interface-Help/spc-function.md) -[Split Function](../../../language/reference/User-Interface-Help/split-function.md) -[Sqr Function](../../../language/reference/User-Interface-Help/sqr-function.md) -[Str Function](../../../language/reference/User-Interface-Help/str-function.md) -[StrComp Function](../../../language/reference/User-Interface-Help/strcomp-function.md) -[StrConv Function](../../../language/reference/User-Interface-Help/strconv-function.md) -[StDev Function](stdev-stdevp-functions-microsoft-access-sql.md) -[StDevP Function](stdev-stdevp-functions-microsoft-access-sql.md) -[String Function](../../../language/reference/User-Interface-Help/string-function.md) -[StringFromGUID Method](../../../api/Access.Application.StringFromGUID.md) -[StrReverse Function](../../../language/reference/User-Interface-Help/strreverse-function.md) -[Sum Function](sum-function-microsoft-access-sql.md) -[Switch Function](../../../language/reference/User-Interface-Help/switch-function.md) -[SYD Function](../../../language/reference/User-Interface-Help/syd-function.md) -[Tab Function](../../../language/reference/User-Interface-Help/tab-function.md) -[Tan Function](../../../language/reference/User-Interface-Help/tan-function.md) -[Time Function](../../../language/reference/User-Interface-Help/time-function.md) -[Timer Function](../../../language/reference/User-Interface-Help/timer-function.md) -[TimeSerial Function](../../../language/reference/User-Interface-Help/timeserial-function.md) -[TimeValue Function](../../../language/reference/User-Interface-Help/timevalue-function.md) -[Trim Function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) -[TypeName Function](../../../language/reference/User-Interface-Help/typename-function.md) -[UBound Function](../../../language/reference/User-Interface-Help/ubound-function.md) -[UCase Function](../../../language/reference/User-Interface-Help/ucase-function.md) -[Val Function](../../../language/reference/User-Interface-Help/val-function.md) -[Var, VarP Functions](var-varp-functions-microsoft-access-sql.md) -[VarType Function](../../../language/reference/User-Interface-Help/vartype-function.md) -[Weekday Function](../../../language/reference/User-Interface-Help/weekday-function.md) -[WeekdayName Function](../../../language/reference/User-Interface-Help/weekdayname-function.md) -[Year Function](../../../language/reference/User-Interface-Help/year-function.md) diff --git a/access/Concepts/Criteria-Expressions/functions-category-list.md b/access/Concepts/Criteria-Expressions/functions-category-list.md index 46eea292b8e..951c0a95a2c 100644 --- a/access/Concepts/Criteria-Expressions/functions-category-list.md +++ b/access/Concepts/Criteria-Expressions/functions-category-list.md @@ -1,411 +1,255 @@ --- -title: Functions (Category List) +title: Functions (category list) ms.prod: access ms.assetid: f6095ed0-465d-6447-321f-4bc1c7c543c5 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Functions (Category List) +# Functions (category list) The following list contains topics that describe common functions used in Access expressions. ## ActiveX -[CreateObject Function](../../../language/reference/User-Interface-Help/createobject-function.md) - -[GetObject Function](../../../language/reference/User-Interface-Help/getobject-function.md) +- [CreateObject function](../../../language/reference/User-Interface-Help/createobject-function.md) +- [GetObject function](../../../language/reference/User-Interface-Help/getobject-function.md) ## Application -[Command Function](../../../language/reference/User-Interface-Help/command-function.md) - -[Shell Function](../../../language/reference/User-Interface-Help/shell-function.md) +- [Command function](../../../language/reference/User-Interface-Help/command-function.md) +- [Shell function](../../../language/reference/User-Interface-Help/shell-function.md) ## Arrays -[Array Function](../../../language/reference/User-Interface-Help/array-function.md) - -[Filter Function](../../../language/reference/User-Interface-Help/filter-function.md) - -[Join Function](../../../language/reference/User-Interface-Help/join-function.md) - -[LBound Function](../../../language/reference/User-Interface-Help/lbound-function.md) - -[Split Function](../../../language/reference/User-Interface-Help/split-function.md) - -[UBound Function](../../../language/reference/User-Interface-Help/ubound-function.md) +- [Array function](../../../language/reference/User-Interface-Help/array-function.md) +- [Filter function](../../../language/reference/User-Interface-Help/filter-function.md) +- [Join function](../../../language/reference/User-Interface-Help/join-function.md) +- [LBound function](../../../language/reference/User-Interface-Help/lbound-function.md) +- [Split function](../../../language/reference/User-Interface-Help/split-function.md) +- [UBound function](../../../language/reference/User-Interface-Help/ubound-function.md) ## Conversion -[Asc Function](../../../language/reference/User-Interface-Help/asc-function.md) - -[CBool Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CByte Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CCur Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CDate Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CDbl Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CDec Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[Chr Function](../../../language/reference/User-Interface-Help/chr-function.md) - -[CInt Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CLng Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CSng Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CStr Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[CVar Function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[Day Function](../../../language/reference/User-Interface-Help/day-function.md) - -[EuroConvert Method](../../../api/Access.Application.EuroConvert.md) - -[FormatCurrency Function](../../../language/reference/User-Interface-Help/formatcurrency-function.md) - -[FormatDateTime Function](../../../language/reference/User-Interface-Help/formatdatetime-function.md) - -[FormatNumber Function](../../../language/reference/User-Interface-Help/formatnumber-function.md) - -[FormatPercent Function](../../../language/reference/User-Interface-Help/formatpercent-function.md) - -[GUIDFromString Method](../../../api/Access.Application.GUIDFromString.md) - -[Hex Function](../../../language/reference/User-Interface-Help/hex-function.md) - -[Nz Method](../../../api/Access.Application.Nz.md) - -[Oct Function](../../../language/reference/User-Interface-Help/oct-function.md) - -[Str Function](../../../language/reference/User-Interface-Help/str-function.md) - -[StringFromGUID Method](../../../api/Access.Application.StringFromGUID.md) - -[Type Conversion Functions](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) - -[Val Function](../../../language/reference/User-Interface-Help/val-function.md) - +- [Asc function](../../../language/reference/User-Interface-Help/asc-function.md) +- [CBool function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CByte function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CCur function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CDate function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CDbl function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CDec function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [Chr function](../../../language/reference/User-Interface-Help/chr-function.md) +- [CInt function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CLng function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CSng function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CStr function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [CVar function](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [Day function](../../../language/reference/User-Interface-Help/day-function.md) +- [EuroConvert method](../../../api/Access.Application.EuroConvert.md) +- [FormatCurrency function](../../../language/reference/User-Interface-Help/formatcurrency-function.md) +- [FormatDateTime function](../../../language/reference/User-Interface-Help/formatdatetime-function.md) +- [FormatNumber function](../../../language/reference/User-Interface-Help/formatnumber-function.md) +- [FormatPercent function](../../../language/reference/User-Interface-Help/formatpercent-function.md) +- [GUIDFromString method](../../../api/Access.Application.GUIDFromString.md) +- [Hex function](../../../language/reference/User-Interface-Help/hex-function.md) +- [Nz method](../../../api/Access.Application.Nz.md) +- [Oct function](../../../language/reference/User-Interface-Help/oct-function.md) +- [Str function](../../../language/reference/User-Interface-Help/str-function.md) +- [StringFromGUID method](../../../api/Access.Application.StringFromGUID.md) +- [Type Conversion functions](../../../Language/Concepts/Getting-Started/type-conversion-functions.md) +- [Val function](../../../language/reference/User-Interface-Help/val-function.md) ## Database -[CurrentUser Method](../../../api/Access.Application.CurrentUser.md) - -[DDEInitiate Method](../../../api/Access.Application.DDEInitiate.md) - -[DDERequest Method](../../../api/Access.Application.DDERequest.md) - -[Eval Method](../../../api/Access.Application.Eval.md) - -[HyperlinkPart Method](../../../api/Access.Application.HyperlinkPart.md) - -[Partition Function](../../../language/reference/User-Interface-Help/partition-function.md) +- [CurrentUser method](../../../api/Access.Application.CurrentUser.md) +- [DDEInitiate method](../../../api/Access.Application.DDEInitiate.md) +- [DDERequest method](../../../api/Access.Application.DDERequest.md) +- [Eval method](../../../api/Access.Application.Eval.md) +- [HyperlinkPart method](../../../api/Access.Application.HyperlinkPart.md) +- [Partition function](../../../language/reference/User-Interface-Help/partition-function.md) ## Date/Time -[Date Function](../../../language/reference/User-Interface-Help/date-function.md) - -[DateAdd Function](../../../language/reference/User-Interface-Help/dateadd-function.md) - -[DateDiff Function](../../../language/reference/User-Interface-Help/datediff-function.md) - -[DatePart Function](../../../language/reference/User-Interface-Help/datepart-function.md) - -[DateSerial Function](../../../language/reference/User-Interface-Help/dateserial-function.md) - -[DateValue Function](../../../language/reference/User-Interface-Help/datevalue-function.md) - -[Day Function](../../../language/reference/User-Interface-Help/day-function.md) - -[Hour Function](../../../language/reference/User-Interface-Help/hour-function.md) - -[Minute Function](../../../language/reference/User-Interface-Help/minute-function.md) - -[Month Function](../../../language/reference/User-Interface-Help/month-function.md) - -[MonthName Function](../../../language/reference/User-Interface-Help/monthname-function.md) - -[Now Function](../../../language/reference/User-Interface-Help/now-function.md) - -[Second Function](../../../language/reference/User-Interface-Help/second-function.md) - -[Time Function](../../../language/reference/User-Interface-Help/time-function.md) - -[Timer Function](../../../language/reference/User-Interface-Help/timer-function.md) - -[TimeSerial Function](../../../language/reference/User-Interface-Help/timeserial-function.md) - -[TimeValue Function](../../../language/reference/User-Interface-Help/timevalue-function.md) - -[Weekday Function](../../../language/reference/User-Interface-Help/weekday-function.md) - -[WeekdayName Function](../../../language/reference/User-Interface-Help/weekdayname-function.md) - -[Year Function](../../../language/reference/User-Interface-Help/year-function.md) - - -## Domain Aggregate - -[DAvg Function](../../../api/Access.application.davg.md) - -[DCount Method](../../../api/Access.Application.DCount.md) - -[DFirst Method](../../../api/Access.Application.DFirst.md) - -[DLast Method](../../../api/Access.Application.DLast.md) - -[DLookup Method](../../../api/Access.Application.DLookup.md) - -[DMax Method](../../../api/Access.Application.DMax.md) - -[DMin Method](../../../api/Access.Application.DMin.md) - -[DStDev Method](../../../api/Access.Application.DStDev.md) - -[DStDevP Method](../../../api/Access.Application.DStDevP.md) - -[DSum Method](../../../api/Access.Application.DSum.md) - -[DVar Method](../../../api/Access.Application.DVar.md) - -[DVarP Method](../../../api/Access.Application.DVarP.md) - - -## Error Handling - -[CVErr Function](../../../language/reference/User-Interface-Help/cverr-function.md) - -[Error Function](../../../language/reference/User-Interface-Help/error-function.md) - -[IsError Function](../../../language/reference/User-Interface-Help/iserror-function.md) - - -## File Input/Output - -[EOF Function](../../../language/reference/User-Interface-Help/eof-function.md) - -[FreeFile Function](../../../language/reference/User-Interface-Help/freefile-function.md) - -[Input Function](../../../language/reference/User-Interface-Help/input-function.md) - -[Loc Function](../../../language/reference/User-Interface-Help/loc-function.md) - -[LOF Function](../../../language/reference/User-Interface-Help/lof-function.md) - -[Seek Function](../../../language/reference/User-Interface-Help/seek-function.md) - - -## File Management - -[CurDir Function](../../../language/reference/User-Interface-Help/curdir-function.md) - -[Dir Function](../../../language/reference/User-Interface-Help/dir-function.md) - -[FileAttr Function](../../../language/reference/User-Interface-Help/fileattr-function.md) - -[FileDateTime Function](../../../language/reference/User-Interface-Help/filedatetime-function.md) - -[FileLen Function](../../../language/reference/User-Interface-Help/filelen-function.md) - -[GetAttr Function](../../../language/reference/User-Interface-Help/getattr-function.md) +- [Date function](../../../language/reference/User-Interface-Help/date-function.md) +- [DateAdd function](../../../language/reference/User-Interface-Help/dateadd-function.md) +- [DateDiff function](../../../language/reference/User-Interface-Help/datediff-function.md) +- [DatePart function](../../../language/reference/User-Interface-Help/datepart-function.md) +- [DateSerial function](../../../language/reference/User-Interface-Help/dateserial-function.md) +- [DateValue function](../../../language/reference/User-Interface-Help/datevalue-function.md) +- [Day function](../../../language/reference/User-Interface-Help/day-function.md) +- [Hour function](../../../language/reference/User-Interface-Help/hour-function.md) +- [Minute function](../../../language/reference/User-Interface-Help/minute-function.md) +- [Month function](../../../language/reference/User-Interface-Help/month-function.md) +- [MonthName function](../../../language/reference/User-Interface-Help/monthname-function.md) +- [Now function](../../../language/reference/User-Interface-Help/now-function.md) +- [Second function](../../../language/reference/User-Interface-Help/second-function.md) +- [Time function](../../../language/reference/User-Interface-Help/time-function.md) +- [Timer function](../../../language/reference/User-Interface-Help/timer-function.md) +- [TimeSerial function](../../../language/reference/User-Interface-Help/timeserial-function.md) +- [TimeValue function](../../../language/reference/User-Interface-Help/timevalue-function.md) +- [Weekday function](../../../language/reference/User-Interface-Help/weekday-function.md) +- [WeekdayName function](../../../language/reference/User-Interface-Help/weekdayname-function.md) +- [Year function](../../../language/reference/User-Interface-Help/year-function.md) + + +## Domain aggregate + +- [DAvg function](../../../api/Access.application.davg.md) +- [DCount method](../../../api/Access.Application.DCount.md) +- [DFirst method](../../../api/Access.Application.DFirst.md) +- [DLast method](../../../api/Access.Application.DLast.md) +- [DLookup method](../../../api/Access.Application.DLookup.md) +- [DMax method](../../../api/Access.Application.DMax.md) +- [DMin method](../../../api/Access.Application.DMin.md) +- [DStDev method](../../../api/Access.Application.DStDev.md) +- [DStDevP method](../../../api/Access.Application.DStDevP.md) +- [DSum method](../../../api/Access.Application.DSum.md) +- [DVar method](../../../api/Access.Application.DVar.md) +- [DVarP method](../../../api/Access.Application.DVarP.md) + + +## Error handling + +- [CVErr function](../../../language/reference/User-Interface-Help/cverr-function.md) +- [Error function](../../../language/reference/User-Interface-Help/error-function.md) +- [IsError function](../../../language/reference/User-Interface-Help/iserror-function.md) + + +## File input/output + +- [EOF function](../../../language/reference/User-Interface-Help/eof-function.md) +- [FreeFile function](../../../language/reference/User-Interface-Help/freefile-function.md) +- [Input function](../../../language/reference/User-Interface-Help/input-function.md) +- [Loc function](../../../language/reference/User-Interface-Help/loc-function.md) +- [LOF function](../../../language/reference/User-Interface-Help/lof-function.md) +- [Seek function](../../../language/reference/User-Interface-Help/seek-function.md) + + +## File management + +- [CurDir function](../../../language/reference/User-Interface-Help/curdir-function.md) +- [Dir function](../../../language/reference/User-Interface-Help/dir-function.md) +- [FileAttr function](../../../language/reference/User-Interface-Help/fileattr-function.md) +- [FileDateTime function](../../../language/reference/User-Interface-Help/filedatetime-function.md) +- [FileLen function](../../../language/reference/User-Interface-Help/filelen-function.md) +- [GetAttr function](../../../language/reference/User-Interface-Help/getattr-function.md) ## Financial -[DDB Function](../../../language/reference/User-Interface-Help/ddb-function.md) - -[FV Function](../../../language/reference/User-Interface-Help/fv-function.md) - -[IPmt Function](../../../language/reference/User-Interface-Help/ipmt-function.md) +- [DDB function](../../../language/reference/User-Interface-Help/ddb-function.md) +- [FV function](../../../language/reference/User-Interface-Help/fv-function.md) +- [IPmt function](../../../language/reference/User-Interface-Help/ipmt-function.md) +- [IRR function](../../../language/reference/User-Interface-Help/irr-function.md) +- [MIRR function](../../../language/reference/User-Interface-Help/mirr-function.md) +- [NPer function](../../../language/reference/User-Interface-Help/nper-function.md) +- [NPV function](../../../language/reference/User-Interface-Help/npv-function.md) +- [Pmt function](../../../language/reference/User-Interface-Help/pmt-function.md) +- [PPmt function](../../../language/reference/User-Interface-Help/ppmt-function.md) +- [PV function](../../../language/reference/User-Interface-Help/pv-function.md) +- [Rate function](../../../language/reference/User-Interface-Help/rate-function.md) +- [SLN function](../../../language/reference/User-Interface-Help/sln-function.md) +- [SYD function](../../../language/reference/User-Interface-Help/syd-function.md) -[IRR Function](../../../language/reference/User-Interface-Help/irr-function.md) - -[MIRR Function](../../../language/reference/User-Interface-Help/mirr-function.md) - -[NPer Function](../../../language/reference/User-Interface-Help/nper-function.md) - -[NPV Function](../../../language/reference/User-Interface-Help/npv-function.md) - -[Pmt Function](../../../language/reference/User-Interface-Help/pmt-function.md) - -[PPmt Function](../../../language/reference/User-Interface-Help/ppmt-function.md) - -[PV Function](../../../language/reference/User-Interface-Help/pv-function.md) - -[Rate Function](../../../language/reference/User-Interface-Help/rate-function.md) - -[SLN Function](../../../language/reference/User-Interface-Help/sln-function.md) - -[SYD Function](../../../language/reference/User-Interface-Help/syd-function.md) ## Inspection -[Environ Function](../../../language/reference/User-Interface-Help/environ-function.md) - -[GetAllSettings Function ](../../../language/reference/User-Interface-Help/getallsettings-function.md) - -[GetSetting Function ](../../../language/reference/User-Interface-Help/getsetting-function.md) - -[IsArray Function](../../../language/reference/User-Interface-Help/isarray-function.md) - -[IsDate Function](../../../language/reference/User-Interface-Help/isdate-function.md) - -[IsEmpty Function](../../../language/reference/User-Interface-Help/isempty-function.md) - -[IsError Function](../../../language/reference/User-Interface-Help/iserror-function.md) - -[IsMissing Function](../../../language/reference/User-Interface-Help/ismissing-function.md) - -[IsNull Function](../../../language/reference/User-Interface-Help/isnull-function.md) - -[IsNumeric Function](../../../language/reference/User-Interface-Help/isnumeric-function.md) - -[IsObject Function](../../../language/reference/User-Interface-Help/isobject-function.md) - -[TypeName Function](../../../language/reference/User-Interface-Help/typename-function.md) - -[VarType Function](../../../language/reference/User-Interface-Help/vartype-function.md) +- [Environ function](../../../language/reference/User-Interface-Help/environ-function.md) +- [GetAllSettings function](../../../language/reference/User-Interface-Help/getallsettings-function.md) +- [GetSetting function](../../../language/reference/User-Interface-Help/getsetting-function.md) +- [IsArray function](../../../language/reference/User-Interface-Help/isarray-function.md) +- [IsDate function](../../../language/reference/User-Interface-Help/isdate-function.md) +- [IsEmpty function](../../../language/reference/User-Interface-Help/isempty-function.md) +- [IsError function](../../../language/reference/User-Interface-Help/iserror-function.md) +- [IsMissing function](../../../language/reference/User-Interface-Help/ismissing-function.md) +- [IsNull function](../../../language/reference/User-Interface-Help/isnull-function.md) +- [IsNumeric function](../../../language/reference/User-Interface-Help/isnumeric-function.md) +- [IsObject function](../../../language/reference/User-Interface-Help/isobject-function.md) +- [TypeName function](../../../language/reference/User-Interface-Help/typename-function.md) +- [VarType function](../../../language/reference/User-Interface-Help/vartype-function.md) ## Math -[Abs Function](../../../language/reference/User-Interface-Help/abs-function.md) - -[Atn Function](../../../language/reference/User-Interface-Help/atn-function.md) - -[Cos Function](../../../language/reference/User-Interface-Help/cos-function.md) - -[Exp Function](../../../language/reference/User-Interface-Help/exp-function.md) - -[Fix Function](../../../language/reference/User-Interface-Help/int-fix-functions.md) - -[Int Function](../../../language/reference/User-Interface-Help/int-fix-functions.md) - -[Log Function](../../../language/reference/User-Interface-Help/log-function.md) - -[Rnd Function](../../../language/reference/User-Interface-Help/rnd-function.md) - -[Round Function](../../../language/reference/User-Interface-Help/round-function.md) - -[Sgn Function](../../../language/reference/User-Interface-Help/sgn-function.md) - -[Sin Function](../../../language/reference/User-Interface-Help/sin-function.md) - -[Sqr Function](../../../language/reference/User-Interface-Help/sqr-function.md) - -[StDev Function](stdev-stdevp-functions-microsoft-access-sql.md) - -[StDevP Function](stdev-stdevp-functions-microsoft-access-sql.md) - -[Tan Function](../../../language/reference/User-Interface-Help/tan-function.md) +- [Abs function](../../../language/reference/User-Interface-Help/abs-function.md) +- [Atn function](../../../language/reference/User-Interface-Help/atn-function.md) +- [Cos function](../../../language/reference/User-Interface-Help/cos-function.md) +- [Exp function](../../../language/reference/User-Interface-Help/exp-function.md) +- [Fix function](../../../language/reference/User-Interface-Help/int-fix-functions.md) +- [Int function](../../../language/reference/User-Interface-Help/int-fix-functions.md) +- [Log function](../../../language/reference/User-Interface-Help/log-function.md) +- [Rnd function](../../../language/reference/User-Interface-Help/rnd-function.md) +- [Round function](../../../language/reference/User-Interface-Help/round-function.md) +- [Sgn function](../../../language/reference/User-Interface-Help/sgn-function.md) +- [Sin function](../../../language/reference/User-Interface-Help/sin-function.md) +- [Sqr function](../../../language/reference/User-Interface-Help/sqr-function.md) +- [StDev function](stdev-stdevp-functions-microsoft-access-sql.md) +- [StDevP function](stdev-stdevp-functions-microsoft-access-sql.md) +- [Tan function](../../../language/reference/User-Interface-Help/tan-function.md) ## Messages -[InputBox Function](../../../language/reference/User-Interface-Help/inputbox-function.md) - -[MsgBox Function](../../../language/reference/User-Interface-Help/msgbox-function.md) +- [InputBox function](../../../language/reference/User-Interface-Help/inputbox-function.md) +- [MsgBox function](../../../language/reference/User-Interface-Help/msgbox-function.md) ## Miscellaneous -[CallByName Function](../../../language/reference/User-Interface-Help/callbyname-function.md) - -[IMEStatus Function](../../../language/reference/User-Interface-Help/imestatus-function.md) - -[QBColor Function](../../../language/reference/User-Interface-Help/qbcolor-function.md) - -[RGB Function](../../../language/reference/User-Interface-Help/rgb-function.md) - -[Spc Function](../../../language/reference/User-Interface-Help/spc-function.md) - -[Tab Function](../../../language/reference/User-Interface-Help/tab-function.md) - - -## Program Flow - -[Choose Function](../../../language/reference/User-Interface-Help/choose-function.md) - -[DoEvents Function](../../../language/reference/User-Interface-Help/doevents-function.md) - -[IIf Function](../../../language/reference/User-Interface-Help/iif-function.md) - -[Switch Function](../../../language/reference/User-Interface-Help/switch-function.md) - - -## SQL Aggregate - -[Avg Function](avg-function-microsoft-access-sql.md) - -[Count Function](count-function-microsoft-access-sql.md) - -[Max Function](min-max-functions-microsoft-access-sql.md) +- [CallByName function](../../../language/reference/User-Interface-Help/callbyname-function.md) +- [IMEStatus function](../../../language/reference/User-Interface-Help/imestatus-function.md) +- [QBColor function](../../../language/reference/User-Interface-Help/qbcolor-function.md) +- [RGB function](../../../language/reference/User-Interface-Help/rgb-function.md) +- [Spc function](../../../language/reference/User-Interface-Help/spc-function.md) +- [Tab function](../../../language/reference/User-Interface-Help/tab-function.md) -[Min Function](min-max-functions-microsoft-access-sql.md) -[StDev Function](stdev-stdevp-functions-microsoft-access-sql.md) +## Program flow -[StDevP Function](stdev-stdevp-functions-microsoft-access-sql.md) +- [Choose function](../../../language/reference/User-Interface-Help/choose-function.md) +- [DoEvents function](../../../language/reference/User-Interface-Help/doevents-function.md) +- [IIf function](../../../language/reference/User-Interface-Help/iif-function.md) +- [Switch function](../../../language/reference/User-Interface-Help/switch-function.md) -[Sum Function](sum-function-microsoft-access-sql.md) -[Var Function](var-varp-functions-microsoft-access-sql.md) +## SQL aggregate -[VarP Function](var-varp-functions-microsoft-access-sql.md) +- [Avg function](avg-function-microsoft-access-sql.md) +- [Count function](count-function-microsoft-access-sql.md) +- [Max function](min-max-functions-microsoft-access-sql.md) +- [Min function](min-max-functions-microsoft-access-sql.md) +- [StDev function](stdev-stdevp-functions-microsoft-access-sql.md) +- [StDevP function](stdev-stdevp-functions-microsoft-access-sql.md) +- [Sum function](sum-function-microsoft-access-sql.md) +- [Var function](var-varp-functions-microsoft-access-sql.md) +- [VarP function](var-varp-functions-microsoft-access-sql.md) ## Text -[Format Function](../../../language/reference/User-Interface-Help/format-function-visual-basic-for-applications.md) - -[HtmlEncode Method](../../../api/Access.Application.HtmlEncode.md) - -[InStr Function](../../../language/reference/User-Interface-Help/instr-function.md) - -[InStrRev Function](../../../language/reference/User-Interface-Help/instrrev-function.md) - -[LCase Function](../../../language/reference/User-Interface-Help/lcase-function.md) - -[Left Function](../../../language/reference/User-Interface-Help/left-function.md) - -[Len Function](../../../language/reference/User-Interface-Help/len-function.md) - -[LTrim Function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) - -[Mid Function](../../../language/reference/User-Interface-Help/mid-function.md) - -[PlainText Method](../../../api/Access.Application.PlainText.md) - -[Replace Function](../../../language/reference/User-Interface-Help/replace-function.md) - -[Right Function](../../../language/reference/User-Interface-Help/right-function.md) - -[RTrim Function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) - -[Space Function](../../../language/reference/User-Interface-Help/space-function.md) - -[StrComp Function](../../../language/reference/User-Interface-Help/strcomp-function.md) - -[StrConv Function](../../../language/reference/User-Interface-Help/strconv-function.md) - -[String Function](../../../language/reference/User-Interface-Help/string-function.md) - -[StrReverse Function](../../../language/reference/User-Interface-Help/strreverse-function.md) - -[Trim Function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) - -[UCase Function](../../../language/reference/User-Interface-Help/ucase-function.md) - - +- [Format function](../../../language/reference/User-Interface-Help/format-function-visual-basic-for-applications.md) +- [HtmlEncode method](../../../api/Access.Application.HtmlEncode.md) +- [InStr function](../../../language/reference/User-Interface-Help/instr-function.md) +- [InStrRev function](../../../language/reference/User-Interface-Help/instrrev-function.md) +- [LCase function](../../../language/reference/User-Interface-Help/lcase-function.md) +- [Left function](../../../language/reference/User-Interface-Help/left-function.md) +- [Len function](../../../language/reference/User-Interface-Help/len-function.md) +- [LTrim function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) +- [Mid function](../../../language/reference/User-Interface-Help/mid-function.md) +- [PlainText method](../../../api/Access.Application.PlainText.md) +- [Replace function](../../../language/reference/User-Interface-Help/replace-function.md) +- [Right function](../../../language/reference/User-Interface-Help/right-function.md) +- [RTrim function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) +- [Space function](../../../language/reference/User-Interface-Help/space-function.md) +- [StrComp function](../../../language/reference/User-Interface-Help/strcomp-function.md) +- [StrConv function](../../../language/reference/User-Interface-Help/strconv-function.md) +- [String function](../../../language/reference/User-Interface-Help/string-function.md) +- [StrReverse function](../../../language/reference/User-Interface-Help/strreverse-function.md) +- [Trim function](../../../language/reference/User-Interface-Help/ltrim-rtrim-and-trim-functions.md) +- [UCase function](../../../language/reference/User-Interface-Help/ucase-function.md) diff --git a/access/Concepts/Criteria-Expressions/include-quotation-marks-in-string-expressions.md b/access/Concepts/Criteria-Expressions/include-quotation-marks-in-string-expressions.md index 12818d6c89d..c5987e5e54e 100644 --- a/access/Concepts/Criteria-Expressions/include-quotation-marks-in-string-expressions.md +++ b/access/Concepts/Criteria-Expressions/include-quotation-marks-in-string-expressions.md @@ -1,21 +1,20 @@ --- -title: Include Quotation Marks in String Expressions +title: Quotation marks in string expressions ms.prod: access ms.assetid: bb4d42ee-37cb-8fbf-0489-62fdf0706b91 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Include Quotation Marks in String Expressions +# Quotation marks in string expressions In situations where you must construct strings to be concatenated, you may need to embed a string within another string, or a string variable within a string. Situations in which you might need to nest one string within another include: - - When specifying criteria for domain aggregate functions. -- When specifying criteria for the **Find** methods. +- When specifying criteria for the **Find** methods. -- When specifying criteria for the **[Filter](../../../api/Access.Form.Filter(property).md)** or **[ServerFilter](../../../api/Access.Form.ServerFilter.md)** property of a form. +- When specifying criteria for the **[Filter](../../../api/Access.Form.Filter(property).md)** or **[ServerFilter](../../../api/Access.Form.ServerFilter.md)** property of a form. - When building SQL strings. @@ -23,58 +22,47 @@ In situations where you must construct strings to be concatenated, you may need In all of these instances, Access must pass a string to the Access database engine. When you specify a _criteria_ argument for a domain aggregate function, for example, Access must evaluate any variables, concatenate them into a string, and then pass the entire string to the Access database engine. If you embed a numeric variable, Access evaluates the variable and simply concatenates the value into the string. If the variable is a text string, however, the resulting criteria string will contain a string within a string. A string within a string must be identified by string delimiters. Otherwise, the Access database engine will not be able to determine which part of the string is the value you want to use. -The string delimiters are not actually part of the variable itself, but they must be included in the string in the _criteria_ argument. There are three different ways to construct the string in the _criteria_ argument. Each method results in a _criteria_ argument that looks like one of the following examples. - +The string delimiters are not actually part of the variable itself, but they must be included in the string in the _criteria_ argument. There are three different ways to construct the string in the _criteria_ argument. Each method results in a _criteria_ argument that looks like one of the following examples. ```vb "[LastName] = 'Smith'" ``` -- or - - - ```vb "[LastName] = ""Smith""" ``` -## Include Single Quotation Marks +## Include single quotation marks -You should include single quotation marks in the _criteria_ argument in such a way that when the value of the variable is concatenated into the string, it will be enclosed within the single quotation marks. For instance, suppose your _criteria_ argument must contain a string variable called . You could construct the _criteria_ argument as in the following example: +You should include single quotation marks in the _criteria_ argument in such a way that when the value of the variable is concatenated into the string, it will be enclosed within the single quotation marks. For example, suppose your _criteria_ argument must contain a string variable called `strName`. You could construct the _criteria_ argument as in the following example: ```vb "[LastName] = '" & strName & "'" ``` -When the variable `strName` is evaluated and concatenated into the _criteria_ string, the _criteria_ string becomes: - - - +When the variable `strName` is evaluated and concatenated into the _criteria_ string, the _criteria_ string becomes: ```vb "[LastName] = 'Smith'" ``` +> [!NOTE] +> This syntax does not permit the use of apostrophes (') within the value of the variable itself. If the value of the string variable includes an apostrophe, Access generates a run-time error. If your variable may represent values containing apostrophes, consider using one of the other syntax forms discussed in the following sections. - **Note** This syntax does not permit the use of apostrophes (') within the value of the variable itself. If the value of the string variable includes an apostrophe, Access generates a run-time error. If your variable may represent values containing apostrophes, consider using one of the other syntax forms discussed in the following sections. - -## Include Double Quotation Marks +## Include double quotation marks You should include double quotation marks within the _criteria_ argument in such a way so that when the value of the variable is evaluated, it will be enclosed within the quotation marks. Within a string, you must use two sets of double quotation marks to represent a single set of double quotation marks. You could construct the _criteria_ argument as in the following example: - ```vb "[LastName] = """ & strName & """" ``` -When the variable `strName` is evaluated and concatenated into the _criteria_ argument, each set of two double quotation marks is replaced by one single quotation mark. The _criteria_ argument becomes: - - - +When the variable `strName` is evaluated and concatenated into the _criteria_ argument, each set of two double quotation marks is replaced by one single quotation mark. The _criteria_ argument becomes: ```vb "[LastName] = 'Smith'" @@ -83,9 +71,9 @@ When the variable `strName` is evaluated and concatenated into the _criteria_ a This syntax may appear more complicated than the single quotation mark syntax, but it enables you to embed a string that contains an apostrophe within the _criteria_ argument. It also enables you to nest one or more strings within the embedded string. -## Include a Variable Representing Quotation Marks +## Include a variable representing quotation marks -You can create a string variable that represents double quotation marks, and concatenate this variable into the _criteria_ argument along with the value of the variable. The ANSI representation for double quotation marks is `Chr$(34)`; you could assign this value to a string variable called `strQuote`. You could then construct the _criteria_ argument as in the following example: +You can create a string variable that represents double quotation marks, and concatenate this variable into the _criteria_ argument along with the value of the variable. The ANSI representation for double quotation marks is `Chr$(34)`; you could assign this value to a string variable called `strQuote`. You could then construct the _criteria_ argument as in the following example: ```vb @@ -94,9 +82,6 @@ You can create a string variable that represents double quotation marks, and con When the variables are evaluated and concatenated into the _criteria_ argument, the _criteria_ argument becomes: - - - ```vb [LastName] = "Smith" ``` diff --git a/access/Concepts/Criteria-Expressions/min-max-functions-microsoft-access-sql.md b/access/Concepts/Criteria-Expressions/min-max-functions-microsoft-access-sql.md index 32fafff9e22..85b177f9c5b 100644 --- a/access/Concepts/Criteria-Expressions/min-max-functions-microsoft-access-sql.md +++ b/access/Concepts/Criteria-Expressions/min-max-functions-microsoft-access-sql.md @@ -1,22 +1,21 @@ --- -title: Min, Max Functions (Microsoft Access SQL) +title: Min, Max functions (Microsoft Access SQL) keywords: jetsql40.chm5278826 f1_keywords: - jetsql40.chm5278826 ms.prod: access ms.assetid: 5ac77377-1f6a-7b4f-ecbb-5480bc5a3187 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Min, Max Functions (Microsoft Access SQL) +# Min, Max functions (Microsoft Access SQL) **Applies to:** Access 2013 | Access 2016 Return the minimum or maximum of a set of values contained in a specified field on a query. ## Syntax - **Min(_expr_)** @@ -26,21 +25,13 @@ The _expr_ placeholder represents a string expression identifying the field tha ## Remarks - -You can use **Min** and **Max** to determine the smallest and largest values in a field based on the specified aggregation, or grouping. For example, you could use these functions to return the lowest and highest freight cost. If there is no aggregation specified, then the entire table is used. +You can use **Min** and **Max** to determine the smallest and largest values in a field based on the specified aggregation, or grouping. For example, you could use these functions to return the lowest and highest freight cost. If there is no aggregation specified, the entire table is used. -You can use **Min** and **Max** in a query expression and in the **SQL** property of a **QueryDef** object or when creating a **Recordset** object based on an SQL query. - -**Link provided by:** -![Community Member Icon](../../../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The[UtterAccess](https://www.utteraccess.com) community |[About the Contributors](#AboutContributors) - - -- [Record Order](https://www.utteraccess.com/wiki/index.php/Record_Order) +You can use **Min** and **Max** in a query expression and in the **SQL** property of a **QueryDef** object or when creating a **Recordset** object based on an SQL query. ## Example - This example uses the Orders table to return the lowest and highest freight charges for orders shipped to the United Kingdom. @@ -77,19 +68,19 @@ End Sub ``` -## About the Contributors - -UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join. +### About the contributors -## See also +**Link provided by** ![Community Member Icon](../../../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) the [UtterAccess](https://www.utteraccess.com) community. -- [Access for developers forum on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev)
-- [Access help on support.office.com](https://support.office.com/search/results?query=Access)
-- [Access help on answers.microsoft.com](https://answers.microsoft.com/en-us/office/forum/access?page=1&;tab=question&;status=all&;auth=1)
-- [Search for specific Access error codes on Bing](https://www.bing.com/)
-- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access wiki on UtterAcess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/)
-- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) +- [Record Order](https://www.utteraccess.com/wiki/index.php/Record_Order) + +UtterAccess is the premier Microsoft Access wiki and help forum. + +## See also +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) \ No newline at end of file diff --git a/access/Concepts/Criteria-Expressions/multiple-fields-in-criteria-expressions.md b/access/Concepts/Criteria-Expressions/multiple-fields-in-criteria-expressions.md index 11dbd61f592..ea42c6d69fb 100644 --- a/access/Concepts/Criteria-Expressions/multiple-fields-in-criteria-expressions.md +++ b/access/Concepts/Criteria-Expressions/multiple-fields-in-criteria-expressions.md @@ -1,24 +1,21 @@ --- -title: Multiple Fields in Criteria Expressions +title: Multiple fields in criteria expressions keywords: vbaac10.chm5187501 f1_keywords: - vbaac10.chm5187501 ms.prod: access ms.assetid: 6ed0992f-912f-10ca-27de-4e3c9d6a2f71 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Multiple Fields in Criteria Expressions +# Multiple fields in criteria expressions You can specify multiple fields in a _criteria_ argument. To specify multiple fields in the _criteria_ argument, you must ensure that multiple string expressions are concatenated correctly to form a valid SQL WHERE clause. In an SQL WHERE clause with multiple fields, fields may be joined with one of three keywords: **AND**, **OR**, or **NOT**. Your expression must evaluate to a string that includes one of these keywords. -For example, suppose that you wish to set the **Filter** property of an Employees form to display records restricted by two sets of criteria. The following example filters the form so that it displays only those employees whose title is "Sales Representative" and who were hired since January 1, 1993: - - - +For example, suppose that you want to set the **[Filter](../../../api/Access.Form.Filter(property).md)** property of an Employees form to display records restricted by two sets of criteria. The following example filters the form so that it displays only those employees whose title is "Sales Representative" and who were hired since January 1, 1993: ```vb Dim datHireDate As Date @@ -28,19 +25,16 @@ datHireDate = #1/1/93# strTitle = "Sales Representative" Forms!Employees.Filter = "[HireDate] >= #" & _ - datHireDate & "# AND [Title] = '" & strTitle & "'" + datHireDate & "# AND [Title] = '" & strTitle & "'" Forms!Employees.FilterOn = True ``` The _criteria_ argument evaluates to the following string: - - ```sql "[HireDate] >= #1-1-93# AND [Title] = 'Sales Representative'" ``` - - **Tip** To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. - +> [!TIP] +> To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. diff --git a/access/Concepts/Criteria-Expressions/numeric-criteria-expressions.md b/access/Concepts/Criteria-Expressions/numeric-criteria-expressions.md index fbdb283a87f..56a2c9c4d84 100644 --- a/access/Concepts/Criteria-Expressions/numeric-criteria-expressions.md +++ b/access/Concepts/Criteria-Expressions/numeric-criteria-expressions.md @@ -1,21 +1,19 @@ --- -title: Numeric Criteria Expressions +title: Numeric criteria expressions keywords: vbaac10.chm5187729 f1_keywords: - vbaac10.chm5187729 ms.prod: access ms.assetid: ff497f13-7251-9131-459f-9bd2b189816b -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Numeric Criteria Expressions +# Numeric criteria expressions To specify numeric criteria for an operation, you supply a numeric value as part of the string expression that forms the _criteria_ argument. -Suppose that you are performing the [Application.DLookup Method (Access)](../../../api/Access.Application.DLookup.md) function on an Employees table to find the last name of a particular employee, and you want to use a value from the EmployeeID field in the function's _criteria_ argument. You could construct a _criteria_ argument like the following example, which returns the last name of the employee whose EmployeeID is 7: - - +Suppose that you are performing the **[DLookup](../../../api/Access.Application.DLookup.md)** function on an Employees table to find the last name of a particular employee, and you want to use a value from the EmployeeID field in the function's _criteria_ argument. You could construct a _criteria_ argument like the following example, which returns the last name of the employee whose EmployeeID is 7: ```vb =DLookup("[LastName]", "Employees", "[EmployeeID] = 7") diff --git a/access/Concepts/Criteria-Expressions/numeric-criteria-from-a-control-on-a-form.md b/access/Concepts/Criteria-Expressions/numeric-criteria-from-a-control-on-a-form.md index 85da3019d72..cd2fa4bebc2 100644 --- a/access/Concepts/Criteria-Expressions/numeric-criteria-from-a-control-on-a-form.md +++ b/access/Concepts/Criteria-Expressions/numeric-criteria-from-a-control-on-a-form.md @@ -1,15 +1,15 @@ --- -title: Numeric Criteria from a Control on a Form +title: Numeric criteria from a control on a form keywords: vbaac10.chm5187731 f1_keywords: - vbaac10.chm5187731 ms.prod: access ms.assetid: faa0806c-f349-09a2-1535-582264434233 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Numeric Criteria from a Control on a Form +# Numeric criteria from a control on a form If you want to change the _criteria_ argument for an operation based on a user's decision, you can specify that the criteria comes from a control on a form. For example, you could specify that the _criteria_ argument comes from a text box containing the EmployeeID number. @@ -17,9 +17,6 @@ To specify numeric criteria coming from a control on a form, you can include in Suppose that you are performing the [DLookup](../../../api/Access.Application.DLookup.md) function on an Employees table to find the last name of an employee based on the EmployeeID number. In the following example, the criteria is determined by the current value of the EmployeeID control on the Orders form. The expression referencing the control is evaluated each time the function is called, so that if the value of the control changes, the criteria argument will reflect that change. - - - ```vb =DLookup("[LastName]", "Employees", "[EmployeeID] = " _ & Forms!Orders!EmployeeID) @@ -27,19 +24,16 @@ Suppose that you are performing the [DLookup](../../../api/Access.Application.DL If the current value of the EmployeeID field is 7, the _criteria_ argument that is passed to the **DLookup** function is: - - ```vb "[EmployeeID] = 7" ``` - - **Tip** To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. +> [!TIP] +> To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. You can also include a variable representing a numeric value in the _criteria_ argument. The variable should be separate from the string expression, so that Access will evaluate the variable first and then concatenate it with the rest of the string expression. -The following example shows how to construct a _criteria_ argument that includes a variable: - +The following example shows how to construct a _criteria_ argument that includes a variable: ```vb Dim intNum As Integer diff --git a/access/Concepts/Criteria-Expressions/quotation-marks-in-strings.md b/access/Concepts/Criteria-Expressions/quotation-marks-in-strings.md deleted file mode 100644 index 1373e82371f..00000000000 --- a/access/Concepts/Criteria-Expressions/quotation-marks-in-strings.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: Quotation Marks in Strings -keywords: vbaac10.chm5187927 -f1_keywords: -- vbaac10.chm5187927 -ms.prod: access -ms.assetid: a25474eb-4451-1cb7-aa05-223bd83cf18c -ms.date: 06/08/2017 ---- - - -# Quotation Marks in Strings - -In situations where you must construct strings to be concatenated, you may need to embed a string within another string, or a string variable within a string. Situations in which you might need to nest one string within another include: - - -- When specifying criteria for domain aggregate functions . - -- When specifying criteria for the **Find** methods. - -- When specifying criteria for the **Filter** or **ServerFilter** property of a form. - -- When building SQL strings. - - -In all of these instances, Access must pass a string to the Microsoft Jet database engine. When you specify a _criteria_ argument for a domain aggregate function, for example, Access must evaluate any variables, concatenate them into a string, and then pass the entire string to the Jet database engine. - -If you embed a numeric variable, Access evaluates the variable and simply concatenates the value into the string. If the variable is a text string, however, the resulting criteria string will contain a string within a string. A string within a string must be identified by string delimiters. Otherwise, the Jet database engine won't be able to determine which part of the string is the value you want to use. -The string delimiters aren't actually part of the variable itself, but they must be included in the string in the _criteria_ argument. There are three different ways to construct the string in the _criteria_ argument. Each method results in a _criteria_ argument that looks like one of the following examples. - - - -```vb -"[LastName] = 'Smith'" -``` - -- or - - - - -```vb -"[LastName] = ""Smith""" -``` - - -## Include Single Quotation Marks - -You should include single quotation marks in the _criteria_ argument in such a way that when the value of the variable is concatenated into the string, it will be enclosed within the single quotation marks. For instance, suppose your _criteria_ argument must contain a string variable called . You could construct the _criteria_ argument as in the following example: - - -```vb -"[LastName] = '" & strName & "'" -``` - -When the variable is evaluated and concatenated into the _criteria_ string, the _criteria_ string becomes: - - - - -```vb -"[LastName] = 'Smith'" -``` - - - **Note** This syntax does not permit the use of apostrophes (') within the value of the variable itself. If the value of the string variable includes an apostrophe, Access generates a run-time error. If your variable may represent values containing apostrophes, consider using one of the other syntax forms discussed in the following sections. - - -## Include Double Quotation Marks - -You should include double quotation marks within the _criteria_ argument in such a way so that when the value of the variable is evaluated, it will be enclosed within the quotation marks. Within a string, you must use two sets of double quotation marks to represent a single set of double quotation marks. You could construct the _criteria_ argument as in the following example: - - -```vb -"[LastName] = """ & strName & """" -``` - -When the variable is evaluated and concatenated into the _criteria_ argument, each set of two double quotation marks is replaced by one single quotation mark. The _criteria_ argument becomes: - - - - -```vb -"[LastName] = 'Smith'" -``` - -This syntax may appear more complicated than the single quotation mark syntax, but it enables you to embed a string that contains an apostrophe within the _criteria_ argument. It also enables you to nest one or more strings within the embedded string. - - -## Include a Variable Representing Quotation Marks - -You can create a string variable that represents double quotation marks, and concatenate this variable into the _criteria_ argument along with the value of the variable. The ANSI representation for double quotation marks is Chr$(34); you could assign this value to a string variable called . You could then construct the _criteria_ argument as in the following example: - - -```vb -"[LastName] = " & strQuote & strName & strQuote -``` - -When the variables are evaluated and concatenated into the _criteria_ argument, the _criteria_ argument becomes: - - - - -```vb -[LastName] = "Smith" -``` - - diff --git a/access/Concepts/Criteria-Expressions/restrict-data-to-a-subset-of-records.md b/access/Concepts/Criteria-Expressions/restrict-data-to-a-subset-of-records.md index 0af7006b311..412f49dacc5 100644 --- a/access/Concepts/Criteria-Expressions/restrict-data-to-a-subset-of-records.md +++ b/access/Concepts/Criteria-Expressions/restrict-data-to-a-subset-of-records.md @@ -1,21 +1,21 @@ --- -title: Restrict Data to a Subset of Records +title: Restrict data to a subset of records keywords: vbaac10.chm5187973 f1_keywords: - vbaac10.chm5187973 ms.prod: access ms.assetid: f3310e1f-9987-785a-9ae2-a2eb375a35c2 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Restrict Data to a Subset of Records +# Restrict data to a subset of records -When working with records you will often need to restrict your data to a specific set of records. Some procedures take a _criteria_ argument that enables you to specify what data should be returned. For example, you specify the _criteria_ argument to restrict which records are returned when you use domain aggregate functions . You may also specify criteria when you use the Find method of a **Recordset** object, set the **Filter** or **ServerFilter** property of a form, or construct a[SQL Statement](../Structured-Query-Language/build-sql-statements-that-include-variables-and-controls.md). Although each of these operations involves a different syntax, you construct the criteria expression in a similar manner for each. - -For example, you can use the **DSum** function, a domain aggregate function, to find the sum total of all freight costs in the Orders table. You could create a calculated control by entering the following expression in the **ControlSource** property: +When working with records, you will often need to restrict your data to a specific set of records. Some procedures take a _criteria_ argument that enables you to specify what data should be returned. For example, you specify the _criteria_ argument to restrict which records are returned when you use domain aggregate functions. +You may also specify criteria when you use the Find method of a **Recordset** object, set the **[Filter](../../../api/Access.Form.Filter(property).md)** or **[ServerFilter](../../../api/Access.Form.ServerFilter.md)** property of a form, or construct a [SQL statement](../Structured-Query-Language/build-sql-statements-that-include-variables-and-controls.md). Although each of these operations involves a different syntax, you construct the criteria expression in a similar manner for each. +For example, you can use the **DSum** function, a domain aggregate function, to find the sum total of all freight costs in the Orders table. You could create a calculated control by entering the following expression in the **ControlSource** property: ```vb =DSum("[Freight]", "Orders") @@ -23,21 +23,23 @@ For example, you can use the **DSum** function, a domain aggregate function, to If you specify the optional _criteria_ argument, the **DSum** function will be performed on a subset of _domain_. For example, you could find the sum total of all freight costs in the Orders table for only those orders being shipped to California: - - ```vb =DSum("[Freight]", "Orders", "[ShipRegion] = 'CA'") ``` -When you supply a _criteria_ argument, Access first evaluates any expressions included in the argument to form a string expression. Then the string expression is passed to the domain function. The string expression is equivalent to an SQL WHERE clause, without the word WHERE. +When you supply a _criteria_ argument, Access first evaluates any expressions included in the argument to form a string expression. The string expression is then passed to the domain function. The string expression is equivalent to an SQL WHERE clause, without the word WHERE. + You can specify numeric, textual, or date/time criteria. No matter what type of criteria you specify, the _criteria_ argument is always converted to a string before being passed to the domain aggregate function. Therefore, you must make certain that after any expressions have been evaluated, all parts of the argument are concatenated into a single string, the whole of which is enclosed in double quotation marks ("). + Use caution when constructing criteria to ensure that the string will be properly concatenated. + The following list of topics outlines the different ways in which you can specify criteria: -[Numeric Criteria Expressions](numeric-criteria-expressions.md) -[Textual Criteria Expressions](textual-criteria-expressions.md) -[Date and Time Criteria Expressions](date-and-time-criteria-expressions.md) -[Change Numeric Criteria from a Control on a Form](numeric-criteria-from-a-control-on-a-form.md) -[Change Textual Criteria from a Control on a Form](textual-criteria-from-a-control-on-a-form.md) -[Change Date and Time Criteria from a Control on a Form](date-and-time-criteria-from-a-control-on-a-form.md) -[Multiple Fields in Criteria Expressions](multiple-fields-in-criteria-expressions.md) + +- [Numeric criteria expressions](numeric-criteria-expressions.md) +- [Textual criteria expressions](textual-criteria-expressions.md) +- [Date and time criteria expressions](date-and-time-criteria-expressions.md) +- [Change numeric criteria from a control on a form](numeric-criteria-from-a-control-on-a-form.md) +- [Change textual criteria from a control on a form](textual-criteria-from-a-control-on-a-form.md) +- [Change date and time criteria from a control on a form](date-and-time-criteria-from-a-control-on-a-form.md) +- [Multiple fields in criteria expressions](multiple-fields-in-criteria-expressions.md) diff --git a/access/Concepts/Criteria-Expressions/sort-records-in-case-sensitiveascii-order.md b/access/Concepts/Criteria-Expressions/sort-records-in-case-sensitiveascii-order.md index a8ee8ce3c36..dc5c2e53f49 100644 --- a/access/Concepts/Criteria-Expressions/sort-records-in-case-sensitiveascii-order.md +++ b/access/Concepts/Criteria-Expressions/sort-records-in-case-sensitiveascii-order.md @@ -1,19 +1,18 @@ --- -title: Sort Records in Case-Sensitive ( ASCII) Order +title: Sort records in case-sensitive (ASCII) order ms.prod: access ms.assetid: 92c74803-2ff3-82b3-ca20-8bef5bfd6004 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Sort Records in Case-Sensitive ( ASCII) Order +# Sort records in case-sensitive (ASCII) order Access sorts records in ascending or descending order without regard to case. However, you can use a user-defined function in a query to sort text data by its ASCII character values. This results in a case-sensitive order. The following table demonstrates how the ascending order in Access differs from a case-sensitive order. - -|**Pre-Sort Order**|**Ascending Order**|**Case-Sensitive Order**| +|**Pre-sort order**|**Ascending order**|**Case-sensitive order**| |:-----|:-----|:-----| |c|A|A| |D|a|B| @@ -24,10 +23,13 @@ The following table demonstrates how the ascending order in Access differs from |A|D|c| |b|d|d| -Although the results in the Ascending Order column might at first appear somewhat unpredictable, they are not. In the Ascending Order column, "a" appears before "A," and " B" appears before "b." This occurs because, when evaluated as text values, "A" = "a" and "B" = "b," whether lowercase or uppercase. Access takes into account the original order of the values. In the Pre-Sort Order column, "a" precedes "A" and "B" precedes "b." +Although the results in the **Ascending order** column might at first appear somewhat unpredictable, they are not. In the **Ascending order** column, "a" appears before "A," and " B" appears before "b." This occurs because, when evaluated as text values, "A" = "a" and "B" = "b," whether lowercase or uppercase. Access takes into account the original order of the values. + +In the **Pre-sort order** column, "a" precedes "A" and "B" precedes "b." + When the case-sensitive sort operation is performed, the text values are replaced with their ASCII values. For example, A = 65, a = 97, B = 66, b = 98, and so on. -The following user-defined function can be used to sort data in case-sensitive order. +The following user-defined function can be used to sort data in case-sensitive order. ```vb @@ -48,21 +50,20 @@ End Function ``` -## Using the StrToHex Function +## StrToHex function The preceding user-defined function, StrToHex, can be called from a query. When you pass the name of the sort field to this function, it will sort the field values in case-sensitive order. The following steps illustrate how to use the function. - 1. Create a query from which you will call this function. -2. In the **Show Table** dialog box, click the table that you want to sort, and then click **Add**. +2. In the **Show Table** dialog box, select the table that you want to sort, and then select **Add**. -3. Drag the fields you want to the grid. +3. Drag the fields that you want to the grid. -4. In the first blank column, in the **Field** row, type **Expr1: StrToHex([ _SortField_ ])**.StrToHex is the user-defined function you created earlier. SortField is the name of the field that contains the case-sensitive values. +4. In the first blank column, in the **Field** row, type **Expr1: StrToHex([ _SortField_ ])**. StrToHex is the user-defined function you created earlier. SortField is the name of the field that contains the case-sensitive values. -5. In the **Sort** cell, click **Ascending** or **Descending**.If you choose ascending order, values beginning with uppercase letters will appear before those that begin with lowercase letters. Applying a descending-order sort does the opposite. +5. In the **Sort** cell, select **Ascending** or **Descending**. If you choose ascending order, values beginning with uppercase letters will appear before those that begin with lowercase letters. Applying a descending-order sort does the opposite. -6. Switch to Datasheet view.Access displays the records, sorted in case-sensitive order. +6. Switch to Datasheet view. Access displays the records, sorted in case-sensitive order. diff --git a/access/Concepts/Criteria-Expressions/stdev-stdevp-functions-microsoft-access-sql.md b/access/Concepts/Criteria-Expressions/stdev-stdevp-functions-microsoft-access-sql.md index 9867a26b9c1..89eafd57b40 100644 --- a/access/Concepts/Criteria-Expressions/stdev-stdevp-functions-microsoft-access-sql.md +++ b/access/Concepts/Criteria-Expressions/stdev-stdevp-functions-microsoft-access-sql.md @@ -1,42 +1,39 @@ --- -title: StDev, StDevP Functions (Microsoft Access SQL) +title: StDev, StDevP functions (Microsoft Access SQL) keywords: jetsql40.chm5278827 f1_keywords: - jetsql40.chm5278827 ms.prod: access ms.assetid: 880875e9-75bc-da59-5554-810e15ce4d54 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# StDev, StDevP Functions (Microsoft Access SQL) +# StDev, StDevP functions (Microsoft Access SQL) **Applies to:** Access 2013 | Access 2016 Return estimates of the standard deviation for a population or a population sample represented as a set of values contained in a specified field on a query. ## Syntax - **StDev(_expr_)** **StDevP(_expr_)** -The _expr_ placeholder represents a string expression identifying the field that contains the numeric data you want to evaluate or an expression that performs a calculation using the data in that field. Operands in _expr_ can include the name of a table field, a constant, or a function (which can be either intrinsic or user-defined but not one of the other SQL aggregate functions). +The _expr_ placeholder represents a string expression identifying the field that contains the numeric data that you want to evaluate or an expression that performs a calculation using the data in that field. Operands in _expr_ can include the name of a table field, a constant, or a function (which can be either intrinsic or user-defined but not one of the other SQL aggregate functions). ## Remarks - -The **StDevP** function evaluates a population, and the **StDev** function evaluates a population sample. +The **StDevP** function evaluates a population, and the **StDev** function evaluates a population sample. -If the underlying query contains fewer than two records (or no records, for the **StDevP** function), these functions return a **Null** value (which indicates that a standard deviation cannot be calculated). +If the underlying query contains fewer than two records (or no records, for the **StDevP** function), these functions return a **Null** value (which indicates that a standard deviation cannot be calculated). -You can use the **StDev** and **StDevP** functions in a query expression. You can also use this expression in the **SQL** property of a **QueryDef** object or when creating a **Recordset** object based on an SQL query. +You can use the **StDev** and **StDevP** functions in a query expression. You can also use this expression in the **SQL** property of a **QueryDef** object or when creating a **Recordset** object based on an SQL query. ## Example - This example uses the Orders table to estimate the standard deviation of the freight charges for orders shipped to the United Kingdom. @@ -87,14 +84,11 @@ End Sub ``` -## See also -- [Access for developers forum on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev)
-- [Access help on support.office.com](https://support.office.com/search/results?query=Access)
-- [Access help on answers.microsoft.com](https://answers.microsoft.com/en-us/office/forum/access?page=1&;tab=question&;status=all&;auth=1)
-- [Search for specific Access error codes on Bing](https://www.bing.com/)
-- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access wiki on UtterAcess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/)
-- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) +## See also +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) \ No newline at end of file diff --git a/access/Concepts/Criteria-Expressions/sum-function-microsoft-access-sql.md b/access/Concepts/Criteria-Expressions/sum-function-microsoft-access-sql.md index 077ace7b16a..5cad9a84baf 100644 --- a/access/Concepts/Criteria-Expressions/sum-function-microsoft-access-sql.md +++ b/access/Concepts/Criteria-Expressions/sum-function-microsoft-access-sql.md @@ -1,22 +1,21 @@ --- -title: Sum Function (Microsoft Access SQL) +title: Sum function (Microsoft Access SQL) keywords: jetsql40.chm5278828 f1_keywords: - jetsql40.chm5278828 ms.prod: access ms.assetid: 02498420-f177-521c-ef81-e2f7ea02b231 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Sum Function (Microsoft Access SQL) +# Sum function (Microsoft Access SQL) **Applies to:** Access 2013 | Access 2016 Returns the sum of a set of values contained in a specified field on a query. ## Syntax - **Sum(_expr_)** @@ -24,11 +23,10 @@ The _expr_ placeholder represents a string expression identifying the field tha ## Remarks - -The **Sum** function totals the values in a field. For example, you could use the **Sum** function to determine the total cost of freight charges. +The **Sum** function totals the values in a field. For example, you could use the **Sum** function to determine the total cost of freight charges. -The **Sum** function ignores records that contain **Null** fields. The following example shows how you can calculate the sum of the products of UnitPrice and Quantity fields: +The **Sum** function ignores records that contain **Null** fields. The following example shows how you can calculate the sum of the products of UnitPrice and Quantity fields: ```sql SELECT @@ -36,11 +34,10 @@ Sum(UnitPrice * Quantity) AS [Total Revenue] FROM [Order Details]; ``` -You can use the **Sum** function in a query expression. You can also use this expression in the **SQL** property of a **QueryDef** object or when creating a **Recordset** based on an SQL query. +You can use the **Sum** function in a query expression. You can also use this expression in the **SQL** property of a **QueryDef** object or when creating a **Recordset** based on an SQL query. ## Example - This example uses the Orders table to calculate the total sales for orders shipped to the United Kingdom. @@ -77,14 +74,11 @@ Sub SumX() End Sub ``` -## See also -- [Access for developers forum on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev)
-- [Access help on support.office.com](https://support.office.com/search/results?query=Access)
-- [Access help on answers.microsoft.com](https://answers.microsoft.com/en-us/office/forum/access?page=1&;tab=question&;status=all&;auth=1)
-- [Search for specific Access error codes on Bing](https://www.bing.com/)
-- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access wiki on UtterAcess](https://www.utteraccess.com/forum/index.php?act=idx)
-- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/)
-- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) +## See also +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) \ No newline at end of file diff --git a/access/Concepts/Criteria-Expressions/textual-criteria-expressions.md b/access/Concepts/Criteria-Expressions/textual-criteria-expressions.md index 5942bea1ac8..321d5f88a09 100644 --- a/access/Concepts/Criteria-Expressions/textual-criteria-expressions.md +++ b/access/Concepts/Criteria-Expressions/textual-criteria-expressions.md @@ -1,32 +1,30 @@ --- -title: Textual Criteria Expressions +title: Textual criteria expressions keywords: vbaac10.chm10884 f1_keywords: - vbaac10.chm10884 ms.prod: access ms.assetid: c90dbb94-daab-5ccb-4cb1-c7771d8c4fc1 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Textual Criteria Expressions +# Textual criteria expressions To specify textual criteria for an operation, you supply a text string as part of the string expression that forms the _criteria_ argument. This text string must be enclosed in single quotation marks ('). - - **Note** The single quotation marks indicate to Access that the _criteria_ argument contains a string within a string. - - -Suppose that you are using the ADO **Find** method to find the first occurrence of a last name in an Employees table. You could construct the _criteria_ argument as in the following example, which moves the current record pointer to the first record in which an employee's last name is Buchanan. Note that the string literal is enclosed in single quotation marks and the entire string comprising the criteria argument must also be enclosed in double quotation marks ("). +> [!NOTE] +> The single quotation marks indicate to Access that the _criteria_ argument contains a string within a string. +Suppose that you are using the ADO **[Find](../../../api/overview/Access.md)** method to find the first occurrence of a last name in an Employees table. You could construct the _criteria_ argument as in the following example, which moves the current record pointer to the first record in which an employee's last name is Buchanan. Note that the string literal `Buchanan` is enclosed in single quotation marks and the entire string comprising the criteria argument must also be enclosed in double quotation marks ("). ```vb Dim rst As New ADODB.Connection rst.open "Employees", CurrentProject.Connection,_ - dbOpenDynaset, adlockoptimistic) + dbOpenDynaset, adlockoptimistic) rst.Find "[LastName] = 'Buchanan'" ``` diff --git a/access/Concepts/Criteria-Expressions/textual-criteria-from-a-control-on-a-form.md b/access/Concepts/Criteria-Expressions/textual-criteria-from-a-control-on-a-form.md index 741b3e1a47a..c4c0e73b68b 100644 --- a/access/Concepts/Criteria-Expressions/textual-criteria-from-a-control-on-a-form.md +++ b/access/Concepts/Criteria-Expressions/textual-criteria-from-a-control-on-a-form.md @@ -1,15 +1,15 @@ --- -title: Textual Criteria from a Control on a Form +title: Textual criteria from a control on a form keywords: vbaac10.chm5188171 f1_keywords: - vbaac10.chm5188171 ms.prod: access ms.assetid: bb139d5e-0807-9492-442d-b7e569d8cecb -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Textual Criteria from a Control on a Form +# Textual criteria from a control on a form If you want to change the _criteria_ argument for an operation based on a user's decision, you can specify that the criteria comes from a control on a form. For example, you could specify that the _criteria_ argument comes from a list box containing the last names of all employees in an Employees table. @@ -17,34 +17,30 @@ To specify textual criteria coming from a control on a form, you include in the In addition to enclosing the entire string expression in double quotation marks ("), you must also ensure that the textual criteria within the string expression is enclosed in single quotation marks ('). The quotation marks must be included in the strings flanking the expression that references the control on the form. - - **Note** The single quotation marks indicate to Access that the _criteria_ argument contains a string within a string. +> [!NOTE] +> The single quotation marks indicate to Access that the _criteria_ argument contains a string within a string. The following example performs a lookup on an Employees table and returns the region in which an employee lives, based on the employee's last name. The current value of a list box control called LastName on the Employees form determines the criteria. Note the placement of the single quotation marks. - - ```vb =DLookup("[Region]", "Employees", "[LastName] = '" _ & Forms!Employees!LastName & "'") ``` -If the current value of the control is , the following _criteria_ argument is passed to the **DLookup** function after Access evaluates the expression and concatenates the strings: - - +If the current value of the control is King, the following _criteria_ argument is passed to the **DLookup** function after Access evaluates the expression and concatenates the strings: ```vb "[LastName] = 'King'" ``` -Keep in mind that the entire string comprising the criteria argument must also be enclosed in double quotation marks once the strings have been concatenated. +Keep in mind that the entire string comprising the criteria argument must also be enclosed in double quotation marks after the strings have been concatenated. - **Tip** To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. +> [!TIP] +> To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. You can also include a variable representing a textual string in the _criteria_ argument. The variable should be separate from the string expression, so that Access will evaluate the variable first and then concatenate it with the rest of the string expression. The textual string must be enclosed in single or double quotation marks. -The following example shows how to construct a _criteria_ argument that includes a variable representing a textual string: - +The following example shows how to construct a _criteria_ argument that includes a variable representing a textual string: ```vb Dim strLastName As String diff --git a/access/Concepts/Criteria-Expressions/use-multiple-fields-in-criteria-expressions.md b/access/Concepts/Criteria-Expressions/use-multiple-fields-in-criteria-expressions.md deleted file mode 100644 index 1de824630f2..00000000000 --- a/access/Concepts/Criteria-Expressions/use-multiple-fields-in-criteria-expressions.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Use Multiple Fields in Criteria Expressions -ms.prod: access -ms.assetid: b0bd588b-b25a-f433-3642-7b06936377e2 -ms.date: 06/08/2017 ---- - - -# Use Multiple Fields in Criteria Expressions - -You can specify multiple fields in a _criteria_ argument. - -To specify multiple fields in the _criteria_ argument, you must ensure that multiple string expressions are concatenated correctly to form a valid SQL WHERE clause. In an SQL WHERE clause with multiple fields, fields may be joined with one of three keywords: **AND**, **OR**, or **NOT**. Your expression must evaluate to a string that includes one of these keywords. - -For example, suppose that you want to set the **[Filter](../../../api/Access.Form.Filter(property).md)** property of an Employees form to display records restricted by two sets of criteria. The following example filters the form so that it displays only those employees whose title is "Sales Representative" and who were hired since January 1, 1993: - - - - -```vb -Dim datHireDate As Date -Dim strTitle As String - -datHireDate = #1/1/93# -strTitle = "Sales Representative" - -Forms!Employees.Filter = "[HireDate] >= #" & _ - datHireDate & "# AND [Title] = '" & strTitle & "'" -Forms!Employees.FilterOn = True -``` - -The _criteria_ argument evaluates to the following string: - - - -```sql -"[HireDate] >= #1-1-93# AND [Title] = 'Sales Representative'" -``` - -To troubleshoot an expression in the _criteria_ argument, break the expression into smaller components and test each individually in the Immediate window. When all of the components are working correctly, put them back together one at a time until the complete expression works correctly. - diff --git a/access/Concepts/Criteria-Expressions/use-numeric-criteria-in-expressions.md b/access/Concepts/Criteria-Expressions/use-numeric-criteria-in-expressions.md deleted file mode 100644 index e4c02aa627d..00000000000 --- a/access/Concepts/Criteria-Expressions/use-numeric-criteria-in-expressions.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Use Numeric Criteria in Expressions -ms.prod: access -ms.assetid: c2055190-8d65-7342-19ef-582c05846b5b -ms.date: 06/08/2017 ---- - - -# Use Numeric Criteria in Expressions - -To specify numeric criteria for an operation, you supply a numeric value as part of the string expression that forms the _criteria_ argument. - -Suppose that you are performing the **[DLookup](../../../api/Access.Application.DLookup.md)** function on an Employees table to find the last name of a particular employee, and you want to use a value from the EmployeeID field in the function's _criteria_ argument. You could construct a _criteria_ argument like the following example, which returns the last name of the employee whose EmployeeID is 7: - - - -```vb -=DLookup("[LastName]", "Employees", "[EmployeeID] = 7") -``` - - diff --git a/access/Concepts/Criteria-Expressions/use-textual-criteria-expressions.md b/access/Concepts/Criteria-Expressions/use-textual-criteria-expressions.md deleted file mode 100644 index fa89b277c39..00000000000 --- a/access/Concepts/Criteria-Expressions/use-textual-criteria-expressions.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Use Textual Criteria Expressions -ms.prod: access -ms.assetid: 72ee596d-b08c-6af4-041a-6771ac8ce524 -ms.date: 06/08/2017 ---- - - -# Use Textual Criteria Expressions - -To specify textual criteria for an operation, you supply a text string as part of the string expression that forms the _criteria_ argument. This text string must be enclosed in single quotation marks ('). - - - **Note** The single quotation marks indicate to Access that the _criteria_ argument contains a string within a string. - - -Suppose that you are using the ADO **[Find](../../../api/overview/Access.md)** method to find the first occurrence of a last name in an Employees table. You could construct the _criteria_ argument as in the following example, which moves the current record pointer to the first record in which an employee's last name is Buchanan. Note that the string literal `Buchanan` is enclosed in single quotation marks and the entire string comprising the criteria argument must also be enclosed in double quotation marks ("). - - - - -```vb -Dim rst As New ADODB.Connection - -rst.open "Employees", CurrentProject.Connection,_ - dbOpenDynaset, adlockoptimistic) -rst.Find "[LastName] = 'Buchanan'" -``` - - diff --git a/access/Concepts/Criteria-Expressions/var-varp-functions-microsoft-access-sql.md b/access/Concepts/Criteria-Expressions/var-varp-functions-microsoft-access-sql.md index 4201be2cf25..2ad8134496b 100644 --- a/access/Concepts/Criteria-Expressions/var-varp-functions-microsoft-access-sql.md +++ b/access/Concepts/Criteria-Expressions/var-varp-functions-microsoft-access-sql.md @@ -1,22 +1,21 @@ --- -title: Var, VarP Functions (Microsoft Access SQL) +title: Var, VarP functions (Microsoft Access SQL) keywords: jetsql40.chm5278829 f1_keywords: - jetsql40.chm5278829 ms.prod: access ms.assetid: 2cac402d-8384-0b33-c203-f493281a95f1 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Var, VarP Functions (Microsoft Access SQL) +# Var, VarP functions (Microsoft Access SQL) **Applies to:** Access 2013 | Access 2016 Return estimates of the variance for a population or a population sample represented as a set of values contained in a specified field on a query. ## Syntax - **Var(_expr_)** @@ -26,17 +25,15 @@ The _expr_ placeholder represents a string expression identifying the field tha ## Remarks - -The **VarP** function evaluates a population, and the **Var** function evaluates a population sample. +The **VarP** function evaluates a population, and the **Var** function evaluates a population sample. -If the underlying query contains fewer than two records, the **Var** and **VarP** functions return a **Null** value, which indicates that a variance cannot be calculated. +If the underlying query contains fewer than two records, the **Var** and **VarP** functions return a **Null** value, which indicates that a variance cannot be calculated. -You can use the **Var** and **VarP** functions in a query expression or in an SQL statement. +You can use the **Var** and **VarP** functions in a query expression or in an SQL statement. ## Example - This example uses the Orders table to estimate the variance of freight costs for orders shipped to the United Kingdom. @@ -87,14 +84,11 @@ End Sub ``` + ## See also -- [Access for developers forum on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) - [Access help on support.office.com](https://support.office.com/search/results?query=Access) -- [Access help on answers.microsoft.com](https://answers.microsoft.com/en-us/office/forum/access?page=1&;tab=question&;status=all&;auth=1) -- [Search for specific Access error codes on Bing](https://www.bing.com/) - [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) -- [Access wiki on UtterAcess](https://www.utteraccess.com/forum/index.php?act=idx) - [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) -- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) - +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) \ No newline at end of file diff --git a/access/Concepts/Data-Access-Objects/add-a-record-to-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/add-a-record-to-a-dao-recordset.md index 8454afc3b5e..f90b64eac1b 100644 --- a/access/Concepts/Data-Access-Objects/add-a-record-to-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/add-a-record-to-a-dao-recordset.md @@ -1,28 +1,25 @@ --- -title: Add a Record to a DAO Recordset +title: Add a record to a DAO Recordset ms.prod: access ms.assetid: b6366906-4b37-0d35-cfd5-d38e7717131c -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Add a Record to a DAO Recordset +# Add a record to a DAO Recordset -You can add a new record to a table-type or dynaset-type **[Recordset](../../../api/overview/Access.md)** object by using the **[AddNew](../../../api/overview/Access.md)** method. +You can add a new record to a table-type or dynaset-type **[Recordset](../../../api/overview/Access.md)** object by using the **[AddNew](../../../api/overview/Access.md)** method. ### To add a record to a table-type or dynaset-type Recordset object: - -1. Use the **AddNew** method to create a record you can edit. +1. Use the **AddNew** method to create a record you can edit. 2. Assign values to each of the record's fields. -3. Use the **[Update](../../../api/overview/Access.md)** method to save the new record. +3. Use the **[Update](../../../api/overview/Access.md)** method to save the new record. -The following code example adds a record to a table-type **Recordset** called Shippers. - - +The following code example adds a record to a table-type **Recordset** called Shippers. ```vb Dim dbsNorthwind As DAO.Database @@ -41,10 +38,13 @@ Dim rstShippers As DAO.Recordset ``` -When you use the **AddNew** method, the Access database engine prepares a new, blank record and makes it the current record. When you use the **Update** method to save the new record, the record that was current before you used the **AddNew** method becomes the current record again. -The new record's position in the **Recordset** depends on whether you added the record to a dynaset-type or a table-type **Recordset** object. If you add a record to a dynaset-type **Recordset**, the new record appears at the end of the **Recordset**, no matter how the **Recordset** is sorted. To force the new record to appear in its properly sorted position, you can either use the **[Requery](../../../api/overview/Access.md)** method or recreate the **Recordset** object. -If you add a record to a table-type Recordset, the record appears positioned according to the current index, or at the end of the table if there is no current index. Because the Access databse engine allows multiple users to create records in a table simultaneously, your record may not appear at the end of the **Recordset**. Be sure to use the **[LastModified](../../../api/overview/Access.md)** property rather than the **[MoveLast](../../../api/overview/Access.md)** method to move to the record you just added. +When you use the **AddNew** method, the Access database engine prepares a new, blank record and makes it the current record. When you use the **Update** method to save the new record, the record that was current before you used the **AddNew** method becomes the current record again. + +The new record's position in the **Recordset** depends on whether you added the record to a dynaset-type or a table-type **Recordset** object. If you add a record to a dynaset-type **Recordset**, the new record appears at the end of the **Recordset**, no matter how the **Recordset** is sorted. To force the new record to appear in its properly sorted position, you can either use the **[Requery](../../../api/overview/Access.md)** method or recreate the **Recordset** object. + +If you add a record to a table-type Recordset, the record appears positioned according to the current index, or at the end of the table if there is no current index. Because the Access database engine allows multiple users to create records in a table simultaneously, your record may not appear at the end of the **Recordset**. Be sure to use the **[LastModified](../../../api/overview/Access.md)** property rather than the **[MoveLast](../../../api/overview/Access.md)** method to move to the record you just added. - **Note** If you use the **AddNew** method to add a record, and then move to another record or close the **Recordset** object without first using the **Update** method, your changes are lost without warning. For example, omitting the **Update** method from the preceding example results in no changes being made to the Shippers table. +> [!NOTE] +> If you use the **AddNew** method to add a record, and then move to another record or close the **Recordset** object without first using the **Update** method, your changes are lost without warning. For example, omitting the **Update** method from the preceding example results in no changes being made to the Shippers table. diff --git a/access/Concepts/Data-Access-Objects/change-tables-involved-in-a-one-to-many-relationship-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/change-tables-involved-in-a-one-to-many-relationship-in-a-dao-recordset.md index 4f2fa37a966..0aebd5d8899 100644 --- a/access/Concepts/Data-Access-Objects/change-tables-involved-in-a-one-to-many-relationship-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/change-tables-involved-in-a-one-to-many-relationship-in-a-dao-recordset.md @@ -1,24 +1,24 @@ --- -title: Change Tables Involved in a One-to-Many Relationship in a DAO Recordset +title: Change tables involved in a one-to-many relationship in a DAO Recordset ms.prod: access ms.assetid: d859066f-dfb5-e3b5-0cc8-fed38c3adb26 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Change Tables Involved in a One-to-Many Relationship in a DAO Recordset - -Dynaset-type **[Recordset](../../../api/overview/Access.md)** objects can be based on a multiple-table query containing tables with a one-to-many relationship. For example, suppose you want to create a multiple-table query that combines fields from the Orders and Order Details tables. Generally speaking, you cannot change values in the Orders table because it is on the "one" side of the relationship. Depending on your application, however, you may want to be able to make changes to the Orders table. - -To make it possible to freely change the values on the "one" side of a one-to-many relationship, use the **dbInconsistent** constant of the **[OpenRecordset](../../../api/overview/Access.md)** method to create an inconsistent dynaset. For example. +# Change tables involved in a one-to-many relationship in a DAO Recordset +Dynaset-type **[Recordset](../../../api/overview/Access.md)** objects can be based on a multiple-table query containing tables with a one-to-many relationship. For example, suppose you want to create a multiple-table query that combines fields from the Orders and Order Details tables. Generally speaking, you cannot change values in the Orders table because it is on the "one" side of the relationship. Depending on your application, however, you may want to be able to make changes to the Orders table. +To make it possible to freely change the values on the "one" side of a one-to-many relationship, use the **dbInconsistent** constant of the **[OpenRecordset](../../../api/overview/Access.md)** method to create an inconsistent dynaset. For example: ```vb Set rstTotalSales = dbs.OpenRecordset("Sales Totals" ,,dbInconsistent) ``` When you update an inconsistent dynaset, you can easily destroy the referential integrity of the data in the dynaset. You must take care to understand how the data is related across the one-to-many relationship and to update the values on both sides in a way that preserves data integrity. -The **dbInconsistent** constant is available only for dynaset-type **Recordset** objects. It is ignored for table, snapshot, and forward-only-type **Recordset** objects, but no compile or run-time error is returned if the **dbInconsistent** constant is used with those types of **Recordset** objects. -Even with an inconsistent **Recordset**, some fields may not be updatable. For example, you cannot change the value of an AutoNumber field, and a **Recordset** based on certain linked tables may not be updatable. + +The **dbInconsistent** constant is available only for dynaset-type **Recordset** objects. It is ignored for table, snapshot, and forward-only-type **Recordset** objects, but no compile or run-time error is returned if the **dbInconsistent** constant is used with those types of **Recordset** objects. + +Even with an inconsistent **Recordset**, some fields may not be updatable. For example, you cannot change the value of an AutoNumber field, and a **Recordset** based on certain linked tables may not be updatable. diff --git a/access/Concepts/Data-Access-Objects/count-the-number-of-records-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/count-the-number-of-records-in-a-dao-recordset.md index 6fdc02c7e69..f3d48da0e11 100644 --- a/access/Concepts/Data-Access-Objects/count-the-number-of-records-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/count-the-number-of-records-in-a-dao-recordset.md @@ -1,23 +1,25 @@ --- -title: Count the Number of Records in a DAO Recordset +title: Count the number of records in a DAO Recordset ms.prod: access ms.assetid: ea524046-4d04-b595-1a45-13b399745f44 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Count the Number of Records in a DAO Recordset +# Count the number of records in a DAO Recordset -You may want to know the number of records in a **[Recordset](../../../api/overview/Access.md)** object. For example, you may want to create a form that shows how many records are in each of the tables in a database. Or you may want to change the appearance of a form or report based on the number of records it includes. +You may want to know the number of records in a **[Recordset](../../../api/overview/Access.md)** object. For example, you may want to create a form that shows how many records are in each of the tables in a database. Or you may want to change the appearance of a form or report based on the number of records it includes. -The **[RecordCount](../../../api/overview/Access.md)** property contains the number of records in a table-type **Recordset** or the total number of records accessed in a dynaset- or snapshot-type **Recordset**. A **Recordset** object with no records has a **RecordCount** property value of 0. +The **[RecordCount](../../../api/overview/Access.md)** property contains the number of records in a table-type **Recordset** or the total number of records accessed in a dynaset- or snapshot-type **Recordset**. A **Recordset** object with no records has a **RecordCount** property value of 0. - **Note** The value of the **RecordCount** property equals the number of records that have actually been accessed. For example, when you first create a dynaset or snapshot, you have accessed (or visited) only one record. If you check the **RecordCount** property immediately after creating the dynaset or snapshot (assuming it has at least one record), the value is 1. To visit all the records, use the **[MoveLast](../../../api/overview/Access.md)** method immediately after opening the **Recordset**, then use **[MoveFirst](../../../api/overview/Access.md)** to return to the first record. This is not done automatically because it may be slow, especially for large result sets. +> [!NOTE] +> The value of the **RecordCount** property equals the number of records that have actually been accessed. For example, when you first create a dynaset or snapshot, you have accessed (or visited) only one record. If you check the **RecordCount** property immediately after creating the dynaset or snapshot (assuming it has at least one record), the value is 1. To visit all the records, use the **[MoveLast](../../../api/overview/Access.md)** method immediately after opening the **Recordset**, and then use **[MoveFirst](../../../api/overview/Access.md)** to return to the first record. This is not done automatically because it may be slow, especially for large result sets. -When you open a table-type **Recordset** object, you effectively visit all of the records in the underlying table, and the value of the **RecordCount** property equals the number of records in the table as soon as the **Recordset** is opened. Canceled transactions may make the value of the **RecordCount** property out-of-date in some multiuser situations. Compacting the database restores the table's record count to the correct value. -The following code example creates a snapshot-type **Recordset** object, and then determines the number of records in the **Recordset**. +When you open a table-type **Recordset** object, you effectively visit all of the records in the underlying table, and the value of the **RecordCount** property equals the number of records in the table as soon as the **Recordset** is opened. +Canceled transactions may make the value of the **RecordCount** property out-of-date in some multiuser situations. Compacting the database restores the table's record count to the correct value. +The following code example creates a snapshot-type **Recordset** object, and then determines the number of records in the **Recordset**. ```vb Function FindRecordCount(strSQL As String) As Long @@ -51,6 +53,9 @@ ErrorHandler: End Function ``` -As your application deletes records in a dynaset-type **Recordset**, the value of the **RecordCount** property decreases. However, in a multiuser environment, records deleted by other users are not reflected in the value of the **RecordCount** property until the current record is positioned on a deleted record. At that time, the setting of the **RecordCount** property decreases by one. Using the **[Requery](../../../api/overview/Access.md)** method on a **Recordset**, followed by the **MoveLast** method, sets the **RecordCount** property to the current total number of records in the **Recordset**. -A snapshot-type **Recordset** object is static and the value of its **RecordCount** property does not change when you add or delete records in the snapshot's underlying table. +As your application deletes records in a dynaset-type **Recordset**, the value of the **RecordCount** property decreases. However, in a multiuser environment, records deleted by other users are not reflected in the value of the **RecordCount** property until the current record is positioned on a deleted record. At that time, the setting of the **RecordCount** property decreases by one. + +Using the **[Requery](../../../api/overview/Access.md)** method on a **Recordset**, followed by the **MoveLast** method, sets the **RecordCount** property to the current total number of records in the **Recordset**. + +A snapshot-type **Recordset** object is static and the value of its **RecordCount** property does not change when you add or delete records in the snapshot's underlying table. diff --git a/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-form.md b/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-form.md index 28aa140593a..0c472db497e 100644 --- a/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-form.md +++ b/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-form.md @@ -1,18 +1,18 @@ --- -title: Create a DAO Recordset From a Form +title: Create a DAO Recordset from a form ms.prod: access ms.assetid: d4bbe327-217d-ba7e-3d9f-3c89af1dcbc9 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Create a DAO Recordset From a Form +# Create a DAO Recordset from a form -You can create a **[Recordset](../../../api/overview/Access.md)** object based on an Access form. To do so, use the **[RecordsetClone](../../../api/Access.Form.RecordsetClone.md)** property of the form. This creates a dynaset-type **Recordset** that refers to the same underlying query or data as the form. If a form is based on a query, referring to the **RecordsetClone** property is the equivalent of creating a dynaset with the same query. You can use the **RecordsetClone** property when you want to apply a method that cannot be used with forms, such as the **[FindFirst](../../../api/overview/Access.md)** method. The **RecordsetClone** property provides access to all the methods and properties that you can use with a dynaset. - -The following example shows how to assign a **Recordset** object to the records in the Orders form. +You can create a **[Recordset](../../../api/overview/Access.md)** object based on an Access form. To do so, use the **[RecordsetClone](../../../api/Access.Form.RecordsetClone.md)** property of the form. This creates a dynaset-type **Recordset** that refers to the same underlying query or data as the form. +If a form is based on a query, referring to the **RecordsetClone** property is the equivalent of creating a dynaset with the same query. You can use the **RecordsetClone** property when you want to apply a method that cannot be used with forms, such as the **[FindFirst](../../../api/overview/Access.md)** method. The **RecordsetClone** property provides access to all the methods and properties that you can use with a dynaset. +The following example shows how to assign a **Recordset** object to the records in the Orders form. ```vb Dim rstOrders As DAO.Recordset @@ -21,5 +21,5 @@ Set rstOrders = Forms!Orders.RecordsetClone ``` -This code always creates the type of **Recordset** being cloned (the type of **Recordset** on which the form is based); no other types are available. Note that the **Recordset** object is declared with the object library qualification. Because Access can use both DAO and ADO, it is better to fully qualify the data access variables by including the object library reference name. +This code always creates the type of **Recordset** being cloned (the type of **Recordset** on which the form is based); no other types are available. Note that the **Recordset** object is declared with the object library qualification. Because Access can use both DAO and ADO, it is better to fully qualify the data access variables by including the object library reference name. diff --git a/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-query.md b/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-query.md index ff60041fc80..06ceec8d503 100644 --- a/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-query.md +++ b/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-query.md @@ -1,14 +1,14 @@ --- -title: Create a DAO Recordset From a Query +title: Create a DAO Recordset from a query ms.prod: access ms.assetid: d84870d4-58e4-9d48-9951-72d928929002 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Create a DAO Recordset From a Query +# Create a DAO Recordset from a query -You can create a **[Recordset](../../../api/overview/Access.md)** object based on a stored select query. In the following code example, Current Product List is an existing select query stored in the current database. +You can create a **[Recordset](../../../api/overview/Access.md)** object based on a stored select query. In the following code example, `Current Product List` is an existing select query stored in the current database. ```vb @@ -21,10 +21,7 @@ Set rstProducts = dbsNorthwind.OpenRecordset("Current Product List") ``` -If a stored select query does not already exist, the **[OpenRecordset](../../../api/overview/Access.md)** method also accepts an SQL string instead of the name of a query. The previous example can be rewritten as follows. - - - +If a stored select query does not already exist, the **[OpenRecordset](../../../api/overview/Access.md)** method also accepts an SQL string instead of the name of a query. The previous example can be rewritten as follows. ```vb Dim dbsNorthwind As DAO.Database diff --git a/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-table-in-the-current-database.md b/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-table-in-the-current-database.md index 3f6ec3ea77a..ecf87bf7f1e 100644 --- a/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-table-in-the-current-database.md +++ b/access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-table-in-the-current-database.md @@ -1,14 +1,14 @@ --- -title: Create a DAO Recordset From a Table In the Current Database +title: Create a DAO Recordset from a table in the current database ms.prod: access ms.assetid: b0507965-e6af-cda4-9d50-fbeb98b4ab89 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Create a DAO Recordset From a Table In the Current Database +# Create a DAO Recordset from a table in the current database -The following code example uses the **[OpenRecordset](../../../api/overview/Access.md)** method to create a table-type **[Recordset](../../../api/overview/Access.md)** object for a table in the current database. +The following code example uses the **[OpenRecordset](../../../api/overview/Access.md)** method to create a table-type **[Recordset](../../../api/overview/Access.md)** object for a table in the current database. ```vb diff --git a/access/Concepts/Data-Access-Objects/create-a-user-defined-property.md b/access/Concepts/Data-Access-Objects/create-a-user-defined-property.md index ea78181e531..d17d376f497 100644 --- a/access/Concepts/Data-Access-Objects/create-a-user-defined-property.md +++ b/access/Concepts/Data-Access-Objects/create-a-user-defined-property.md @@ -1,14 +1,14 @@ --- -title: Create a User-Defined Property +title: Create a user-defined property ms.prod: access ms.assetid: 49d2fede-2fb5-0b1b-42cd-6147756ea1ca -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Create a User-Defined Property +# Create a user-defined property -The following example attempts to set the value of a user-defined property. If the property does not exist, it uses the **[CreateProperty](../../../api/overview/Access.md)** method to create and set the value of the new property. +The following example attempts to set the value of a user-defined property. If the property does not exist, it uses the **[CreateProperty](../../../api/overview/Access.md)** method to create and set the value of the new property. ```vb diff --git a/access/Concepts/Data-Access-Objects/delete-a-record-from-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/delete-a-record-from-a-dao-recordset.md index ae0a48c959e..5ebb1f7be86 100644 --- a/access/Concepts/Data-Access-Objects/delete-a-record-from-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/delete-a-record-from-a-dao-recordset.md @@ -1,14 +1,14 @@ --- -title: Delete a Record From a DAO Recordset +title: Delete a record from a DAO Recordset ms.prod: access ms.assetid: 7407b757-4c00-2ea7-c93f-303c09afff26 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Delete a Record From a DAO Recordset +# Delete a record from a DAO Recordset -You can delete an existing record in a table or dynaset-type **[Recordset](../../../api/overview/Access.md)** object by using the **[Delete](../../../api/overview/Access.md)** method. You cannot delete records from a snapshot-type **Recordset** object. The following code example deletes all the duplicate records in the Shippers table. +You can delete an existing record in a table or dynaset-type **[Recordset](../../../api/overview/Access.md)** object by using the **[Delete](../../../api/overview/Access.md)** method. You cannot delete records from a snapshot-type **Recordset** object. The following code example deletes all the duplicate records in the Shippers table. ```vb @@ -48,8 +48,9 @@ End Function ``` -When you use the **Delete** method, the Access database engine immediately deletes the current record without any warning or prompting. Deleting a record does not automatically cause the next record to become the current record; to move to the next record you must use the **[MoveNext](../../../api/overview/Access.md)** method. Be aware that after you have moved off the deleted record, you cannot move back to it. +When you use the **Delete** method, the Access database engine immediately deletes the current record without any warning or prompting. Deleting a record does not automatically cause the next record to become the current record; to move to the next record you must use the **[MoveNext](../../../api/overview/Access.md)** method. Be aware that after you have moved off the deleted record, you cannot move back to it. -If you try to access a record after deleting it on a table-type **Recordset**, you will see error 3167, "Record is deleted." On a dynaset, you will see error 3021, "No current record." -If you have a **Recordset** clone positioned at the deleted record and you try to read its value, you will see error 3167 regardless of the type of **Recordset** object. Trying to use a bookmark to move to a deleted record will also result in error 3167. +If you try to access a record after deleting it on a table-type **Recordset**, you will see error 3167, "Record is deleted." On a dynaset, you will see error 3021, "No current record." + +If you have a **Recordset** clone positioned at the deleted record, and you try to read its value, you will see error 3167 regardless of the type of **Recordset** object. Trying to use a bookmark to move to a deleted record will also result in error 3167. diff --git a/access/Concepts/Data-Access-Objects/detect-the-limits-of-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/detect-the-limits-of-a-dao-recordset.md index cc3b557c342..7fd15bb9913 100644 --- a/access/Concepts/Data-Access-Objects/detect-the-limits-of-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/detect-the-limits-of-a-dao-recordset.md @@ -1,21 +1,20 @@ --- -title: Detect the Limits of a DAO Recordset +title: Detect the limits of a DAO Recordset ms.prod: access ms.assetid: f4be9ea8-25af-1c5c-4cd7-43d57e5d4d8b -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Detect the Limits of a DAO Recordset +# Detect the limits of a DAO Recordset -In a **[Recordset](../../../api/overview/Access.md)** object, if you try to move beyond the beginning or ending record, a run-time error occurs. For example, if you try to use the **[MoveNext](../../../api/overview/Access.md)** method when you are already at the last record of the **Recordset**, a trappable error occurs. For this reason, it is helpful to know the limits of the **Recordset** object. - -The **[BOF](../../../api/overview/Access.md)** property indicates whether the current position is at the beginning of the **Recordset**. If **BOF** is **True**, the current position is before the first record in the **Recordset**. The **BOF** property is also **True** if there are no records in the **Recordset** when it is opened. Similarly, the **[EOF](../../../api/overview/Access.md)** property is **True** if the current position is after the last record in the **Recordset**, or if there are no records. - -The following code example shows how to use the **BOF** and **EOF** properties to detect the beginning and end of a **Recordset** object. This code fragment creates a table-type **Recordset** based on the Orders table from the current database. It moves through the records, first from the beginning of the **Recordset** to the end, and then from the end of the **Recordset** to the beginning. +In a **[Recordset](../../../api/overview/Access.md)** object, if you try to move beyond the beginning or ending record, a run-time error occurs. For example, if you try to use the **[MoveNext](../../../api/overview/Access.md)** method when you are already at the last record of the **Recordset**, a trappable error occurs. For this reason, it is helpful to know the limits of the **Recordset** object. +The **[BOF](../../../api/overview/Access.md)** property indicates whether the current position is at the beginning of the **Recordset**. If **BOF** is **True**, the current position is before the first record in the **Recordset**. The **BOF** property is also **True** if there are no records in the **Recordset** when it is opened. +Similarly, the **[EOF](../../../api/overview/Access.md)** property is **True** if the current position is after the last record in the **Recordset**, or if there are no records. +The following code example shows how to use the **BOF** and **EOF** properties to detect the beginning and end of a **Recordset** object. This code fragment creates a table-type **Recordset** based on the Orders table from the current database. It moves through the records, first from the beginning of the **Recordset** to the end, and then from the end of the **Recordset** to the beginning. ```vb Dim dbsNorthwind As DAO.Database @@ -44,18 +43,18 @@ Dim rstOrders As DAO.Recordset ``` -Be aware that there is no current record immediately following the first loop. The **BOF** and **EOF** properties both have the following characteristics. +Be aware that there is no current record immediately following the first loop. The **BOF** and **EOF** properties both have the following characteristics. -- If the **Recordset** contains no records when you open it, both **BOF** and **EOF** are **True**. +- If the **Recordset** contains no records when you open it, both **BOF** and **EOF** are **True**. -- When **BOF** or **EOF** is **True**, the property remains **True** until you move to an existing record, at which time the value of **BOF** or **EOF** becomes **False**. +- When **BOF** or **EOF** is **True**, the property remains **True** until you move to an existing record, at which time the value of **BOF** or **EOF** becomes **False**. -- When **BOF** or **EOF** is **False**, and the only record in a **Recordset** is deleted, the property remains **False** until you try to move to another record, at which time both **BOF** and **EOF** become **True**. +- When **BOF** or **EOF** is **False**, and the only record in a **Recordset** is deleted, the property remains **False** until you try to move to another record, at which time both **BOF** and **EOF** become **True**. -- At the moment you create or open a **Recordset** that contains at least one record, the first record is the current record, and both **BOF** and **EOF** are **False**. +- At the moment you create or open a **Recordset** that contains at least one record, the first record is the current record, and both **BOF** and **EOF** are **False**. -- If the first record is the current record when you use the **MovePrevious** method, **BOF** is set to **True**. If you use **MovePrevious** while **BOF** is **True**, a run-time error occurs. When this happens, **BOF** remains **True** and there is no current record. +- If the first record is the current record when you use the **MovePrevious** method, **BOF** is set to **True**. If you use **MovePrevious** while **BOF** is **True**, a run-time error occurs. When this happens, **BOF** remains **True** and there is no current record. -- Similarly, moving past the last record in the **Recordset** changes the value of the **EOF** property to **True**. If you use the **MoveNext** method while **EOF** is **True**, a run-time error occurs. When this happens, **EOF** remains **True** and there is no current record. +- Similarly, moving past the last record in the **Recordset** changes the value of the **EOF** property to **True**. If you use the **MoveNext** method while **EOF** is **True**, a run-time error occurs. When this happens, **EOF** remains **True** and there is no current record. diff --git a/access/Concepts/Data-Access-Objects/extract-data-from-a-record-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/extract-data-from-a-record-in-a-dao-recordset.md index 1950f3bc2df..7e07fe87455 100644 --- a/access/Concepts/Data-Access-Objects/extract-data-from-a-record-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/extract-data-from-a-record-in-a-dao-recordset.md @@ -1,19 +1,19 @@ --- -title: Extract Data from a Record in a DAO Recordset +title: Extract data from a record in a DAO Recordset ms.prod: access ms.assetid: cd0d8c73-c9a7-3565-514d-6b379ac2d690 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Extract Data from a Record in a DAO Recordset +# Extract data from a record in a DAO Recordset After you have located a particular record or records, you may want to extract data to use in your application instead of modifying the underlying source table. -## Copying a Single Field +## Copy a single field -You can copy a single field of a record to a variable of the appropriate data type. The following example extracts three fields from the first record in a **[Recordset](../../../api/overview/Access.md)** object. +You can copy a single field of a record to a variable of the appropriate data type. The following example extracts three fields from the first record in a **[Recordset](../../../api/overview/Access.md)** object. ```vb @@ -34,27 +34,21 @@ Dim strTitle As String ``` -## Copying Entire Records to an Array +## Copy entire records to an array To copy one or more records, you can create a two-dimensional array and copy records one at a time. You increment the first subscript for each field and the second subscript for each record. -A fast way to do this is to use the **[GetRows](../../../api/overview/Access.md)** method, which returns a two-dimensional array. The first subscript identifies the field and the second identifies the row number, as follows. - - - +A fast way to do this is to use the **[GetRows](../../../api/overview/Access.md)** method, which returns a two-dimensional array. The first subscript identifies the field and the second identifies the row number, as follows. ```vb varRecords(intField, intRecord) ``` -The following code example uses an SQL statement to retrieve three fields from a table called Employees into a **Recordset** object. It then uses the **GetRows** method to retrieve the first three records of the **Recordset**, and it stores the selected records in a two-dimensional array. It then prints each record, one field at a time, by using the two array indexes to select specific fields and records. +The following code example uses an SQL statement to retrieve three fields from a table called Employees into a **Recordset** object. It then uses the **GetRows** method to retrieve the first three records of the **Recordset**, and it stores the selected records in a two-dimensional array. It then prints each record, one field at a time, by using the two array indexes to select specific fields and records. To show how the array indexes are used, the following example uses a separate statement to identify and print each field of each record. In practice, it would be more reliable to use two loops, one nested in the other, and to provide integer variables for the indexes that step through both dimensions of the array. - - - ```vb Sub GetRowsTest() @@ -96,12 +90,14 @@ ErrorHandler: End Sub ``` -You can use subsequent calls to the **GetRows** method if more records are available. Because the array is filled as soon as you call the **GetRows** method, you can see why this approach is much faster than copying one field at a time. +You can use subsequent calls to the **GetRows** method if more records are available. Because the array is filled as soon as you call the **GetRows** method, you can see why this approach is much faster than copying one field at a time. + +Notice also that you do not have to declare the Variant as an array, because this is done automatically when the **GetRows** method returns records. This enables you to use fixed-length array dimensions without knowing how many records or fields will be returned, instead of using variable-length dimensions that take up more memory. -Notice also that you do not have to declare the Variant as an array, because this is done automatically when the **GetRows** method returns records. This enables you to use fixed-length array dimensions without knowing how many records or fields will be returned, instead of using variable-length dimensions that take up more memory. +If you are trying to retrieve all the rows by using multiple **GetRows** calls, use the **[EOF](../../../api/overview/Access.md)** property to be sure that you are at the end of the **Recordset**. The **GetRows** method may return fewer rows than you request. If you request more than the remaining number of rows in a **Recordset**, for example, the **GetRows** method returns only the rows that remain. Similarly, if it cannot retrieve a row in the range requested, it does not return that row. -If you are trying to retrieve all the rows by using multiple **GetRows** calls, use the **[EOF](../../../api/overview/Access.md)** property to be sure that you are at the end of the **Recordset**. The **GetRows** method may return fewer rows than you request. If you request more than the remaining number of rows in a **Recordset**, for example, the **GetRows** method returns only the rows that remain. Similarly, if it cannot retrieve a row in the range requested, it does not return that row. For example, if the fifth record cannot be retrieved in a group of 10 records that you are trying to retrieve, the **GetRows** method returns four records and leaves the current record position on the record that caused a problem, and does not generate a run-time error. This situation may occur if a record in a dynaset was deleted by another user. If it returns fewer records than the number requested and you are not at the end of the file, you need to read each field in the current record to determine what error the **GetRows** method encountered. +For example, if the fifth record cannot be retrieved in a group of 10 records that you are trying to retrieve, the **GetRows** method returns four records and leaves the current record position on the record that caused a problem, and does not generate a run-time error. This situation may occur if a record in a dynaset was deleted by another user. If it returns fewer records than the number requested and you are not at the end of the file, you need to read each field in the current record to determine what error the **GetRows** method encountered. -Because the **GetRows** method always returns all the fields in the **Recordset** object, you may want to create a query that returns just the fields that you need. This is especially important for OLE Object and Memo fields. +Because the **GetRows** method always returns all the fields in the **Recordset** object, you may want to create a query that returns just the fields that you need. This is especially important for OLE Object and Memo fields. diff --git a/access/Concepts/Data-Access-Objects/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset.md b/access/Concepts/Data-Access-Objects/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset.md index c1d367f3124..e80146bdbbb 100644 --- a/access/Concepts/Data-Access-Objects/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset.md @@ -1,33 +1,34 @@ --- -title: Find a Record in a Dynaset-Type or Snapshot-Type DAO Recordset +title: Find a record in a dynaset-type or snapshot-type DAO Recordset ms.prod: access ms.assetid: f79f47e1-63a9-774d-4d07-32759ac30c8b -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Find a Record in a Dynaset-Type or Snapshot-Type DAO Recordset +# Find a record in a dynaset-type or snapshot-type DAO Recordset -You can use the Find methods to locate a record in a dynaset-type or snapshot-type **[Recordset](../../../api/overview/Access.md)** object. DAO provides the following Find methods: +You can use the Find methods to locate a record in a dynaset-type or snapshot-type **[Recordset](../../../api/overview/Access.md)** object. DAO provides the following Find methods: -- The **[FindFirst](../../../api/overview/Access.md)** method finds the first record that satisfies the specified criteria. +- The **[FindFirst](../../../api/overview/Access.md)** method finds the first record that satisfies the specified criteria. -- The **[FindLast](../../../api/overview/Access.md)** method finds the last record that satisfies the specified criteria. +- The **[FindLast](../../../api/overview/Access.md)** method finds the last record that satisfies the specified criteria. -- The **[FindNext](../../../api/overview/Access.md)** method finds the next record that satisfies the specified criteria. +- The **[FindNext](../../../api/overview/Access.md)** method finds the next record that satisfies the specified criteria. -- The **[FindPrevious](../../../api/overview/Access.md)** method finds the previous record that satisfies the specified criteria. +- The **[FindPrevious](../../../api/overview/Access.md)** method finds the previous record that satisfies the specified criteria. When you use the Find methods, you specify the search criteria, which is typically an expression that equates a field name with a specific value. -You can locate the matching records in reverse order by finding the last occurrence with the **FindLast** method and then using the **FindPrevious** method instead of the **FindNext** method. -DAO sets the **[NoMatch](../../../api/overview/Access.md)** property to **True** when a Find method fails and the current record position is undefined. There may be a current record, but there is no way to tell which one. To return to the previous current record following a failed Find method, use a bookmark. -The **NoMatch** property is **False** when the operation succeeds. In this case, the current record position is the record found by one of the Find methods. -The following example illustrates how you can use the **FindNext** method to find all orders in the Orders table that have no corresponding records in the Order Details table. The function searches for missing orders and, if it finds one, it adds the value in the OrderID field to the array aryOrders(). +You can locate the matching records in reverse order by finding the last occurrence with the **FindLast** method and then using the **FindPrevious** method instead of the **FindNext** method. +DAO sets the **[NoMatch](../../../api/overview/Access.md)** property to **True** when a Find method fails and the current record position is undefined. There may be a current record, but there is no way to tell which one. To return to the previous current record following a failed Find method, use a bookmark. +The **NoMatch** property is **False** when the operation succeeds. In this case, the current record position is the record found by one of the Find methods. + +The following example illustrates how you can use the **FindNext** method to find all orders in the Orders table that have no corresponding records in the Order Details table. The function searches for missing orders and, if it finds one, it adds the value in the OrderID field to the array aryOrders(). ```vb Function FindOrders() As Variant diff --git a/access/Concepts/Data-Access-Objects/find-a-record-in-a-table-type-dao-recordset.md b/access/Concepts/Data-Access-Objects/find-a-record-in-a-table-type-dao-recordset.md index 0bb38e18cbf..5a205ba141f 100644 --- a/access/Concepts/Data-Access-Objects/find-a-record-in-a-table-type-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/find-a-record-in-a-table-type-dao-recordset.md @@ -1,20 +1,21 @@ --- -title: Find a Record in a Table-Type DAO Recordset +title: Find a record in a table-type DAO Recordset ms.prod: access ms.assetid: b17f14db-9b3e-7f12-9fc8-f56c6dcbad09 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Find a Record in a Table-Type DAO Recordset +# Find a record in a table-type DAO Recordset -You use the **[Seek](../../../api/overview/Access.md)** method to locate a record in a table-type **[Recordset](../../../api/overview/Access.md)** object. +You use the **[Seek](../../../api/overview/Access.md)** method to locate a record in a table-type **[Recordset](../../../api/overview/Access.md)** object. -When you use the **Seek** method to locate a record, the Access database engine uses the table's current index, as defined by the **[Index](../../../api/overview/Access.md)** property. +When you use the **Seek** method to locate a record, the Access database engine uses the table's current index, as defined by the **[Index](../../../api/overview/Access.md)** property. - **Note** If you use the **Seek** method on a table-type **Recordset** object without first setting the current index, a run-time error occurs. +> [!NOTE] +> If you use the **Seek** method on a table-type **Recordset** object without first setting the current index, a run-time error occurs. -The following example opens a table-type **Recordset** object called Employees, and uses the Seek method to locate the record containing a value of **lngEmpID** in the EmployeeID field. It returns the hire date for the specified employee. +The following example opens a table-type **Recordset** object called Employees, and uses the Seek method to locate the record containing a value of **lngEmpID** in the EmployeeID field. It returns the hire date for the specified employee. @@ -52,11 +53,11 @@ ErrorHandler: End Function ``` -The **Seek** method always starts searching for records at the beginning of the **Recordset** object. If you use the **Seek** method with the same arguments more than once on the same **Recordset**, it finds the same record. -You can use the **[NoMatch](../../../api/overview/Access.md)** property on the **Recordset** object to test whether a record matching the search criteria was found. If the record matching the criteria was found, the **NoMatch** property will be **False**; otherwise it will be **True**. -The following code example shows how you can create a function that uses the **Seek** method to locate a record by using a multiple-field index. +The **Seek** method always starts searching for records at the beginning of the **Recordset** object. If you use the **Seek** method with the same arguments more than once on the same **Recordset**, it finds the same record. +You can use the **[NoMatch](../../../api/overview/Access.md)** property on the **Recordset** object to test whether a record matching the search criteria was found. If the record matching the criteria was found, the **NoMatch** property will be **False**; otherwise it will be **True**. +The following code example shows how you can create a function that uses the **Seek** method to locate a record by using a multiple-field index. ```vb Function GetFirstPrice(lngOrderID As Long, lngProductID As Long) As Variant @@ -91,6 +92,7 @@ ErrorHandler: End Function ``` -In this example, the table's primary key consists of two fields: OrderID and ProductID. When you call the GetFirstPrice function with a valid (existing) combination of OrderID and ProductID field values, the function returns the unit price from the found record. If it cannot find the combination of field values you want in the table, the function returns the **Null** value. -If the current index is a multiple-field index, trailing key values can be omitted and are treated as **Null** values. That is, you can leave off any number of key values from the end of a **Seek** method's _key_ argument, but not from the beginning or the middle. However, if you do not specify all values in the index, you can use only the ">" or "<" comparison string with the **Seek** method. +In this example, the table's primary key consists of two fields: OrderID and ProductID. When you call the GetFirstPrice function with a valid (existing) combination of OrderID and ProductID field values, the function returns the unit price from the found record. If it cannot find the combination of field values you want in the table, the function returns the **Null** value. + +If the current index is a multiple-field index, trailing key values can be omitted and are treated as **Null** values. That is, you can leave off any number of key values from the end of a **Seek** method's _key_ argument, but not from the beginning or the middle. However, if you do not specify all values in the index, you can use only the ">" or "<" comparison string with the **Seek** method. diff --git a/access/Concepts/Data-Access-Objects/find-the-current-position-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/find-the-current-position-in-a-dao-recordset.md index d843a685035..faf082caa3a 100644 --- a/access/Concepts/Data-Access-Objects/find-the-current-position-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/find-the-current-position-in-a-dao-recordset.md @@ -1,25 +1,25 @@ --- -title: Find the Current Position in a DAO Recordset +title: Find the current position in a DAO Recordset ms.prod: access ms.assetid: 1f08caa7-b671-b844-59a0-f924a5220cf4 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Find the Current Position in a DAO Recordset +# Find the current position in a DAO Recordset -In some situations, you need to determine how far through a **[Recordset](../../../api/overview/Access.md)** object you have moved the current record position, and perhaps indicate the current record position to a user. For example, you may want to indicate the current position on a dial, meter, or similar type of control. Two properties are available to indicate the current position: the **[AbsolutePosition](../../../api/overview/Access.md)** property and the **[PercentPosition](../../../api/overview/Access.md)** property. +In some situations, you need to determine how far through a **[Recordset](../../../api/overview/Access.md)** object you have moved the current record position, and perhaps indicate the current record position to a user. For example, you may want to indicate the current position on a dial, meter, or similar type of control. Two properties are available to indicate the current position: the **[AbsolutePosition](../../../api/overview/Access.md)** property and the **[PercentPosition](../../../api/overview/Access.md)** property. -The **AbsolutePosition** property value is the position of the current record relative to 0. However, do not think of this property as a record number; if the current record is undefined, the **AbsolutePosition** property returns 1. In addition, there is no assurance that a record will have the same absolute position if the **Recordset** object is recreated because the order of individual records within a **Recordset** object is not guaranteed unless it is created with an SQL statement that includes an ORDER BY clause. +The **AbsolutePosition** property value is the position of the current record relative to 0. However, do not think of this property as a record number; if the current record is undefined, the **AbsolutePosition** property returns 1. In addition, there is no assurance that a record will have the same absolute position if the **Recordset** object is recreated because the order of individual records within a **Recordset** object is not guaranteed unless it is created with an SQL statement that includes an ORDER BY clause. -The **PercentPosition** property shows the current position expressed as a percentage of the total number of records indicated by the **[RecordCount](../../../api/overview/Access.md)** property. Because the **RecordCount** property does not reflect the total number of records in the **Recordset** object until the **Recordset** has been fully populated, the **PercentPosition** property reflects only the current record position as a percentage of the number of records that have been accessed since the **Recordset** was opened. To make sure that the **PercentPosition** property reflects the current record position relative to the entire **Recordset**, use the **[MoveLast](../../../api/overview/Access.md)** and **[MoveFirst](../../../api/overview/Access.md)** methods immediately after opening the **Recordset**. This fully populates the **Recordset** object before you use the **PercentPosition** property. If you have a large result set, using the **MoveLast** method may take a long time for **Recordsets** that are not of type table. +The **PercentPosition** property shows the current position expressed as a percentage of the total number of records indicated by the **[RecordCount](../../../api/overview/Access.md)** property. Because the **RecordCount** property does not reflect the total number of records in the **Recordset** object until the **Recordset** has been fully populated, the **PercentPosition** property reflects only the current record position as a percentage of the number of records that have been accessed since the **Recordset** was opened. +To make sure that the **PercentPosition** property reflects the current record position relative to the entire **Recordset**, use the **[MoveLast](../../../api/overview/Access.md)** and **[MoveFirst](../../../api/overview/Access.md)** methods immediately after opening the **Recordset**. This fully populates the **Recordset** object before you use the **PercentPosition** property. If you have a large result set, using the **MoveLast** method may take a long time for **Recordsets** that are not of type table. - **Note** The **PercentPosition** property is only an approximation and should not be used as a critical parameter. This property is best suited for driving an indicator that marks a user's progress while moving though a set of records. For example, you may want a control that indicates the percentage of records completed. - -The following example opens a **Recordset** object on a table called Employees. The procedure then moves through the Employees table and uses the **[SysCmd](../../../api/Access.Application.SysCmd.md)** method to display a progress bar showing the percentage of the table that has been processed. If the hire date of the employee is before Jan. 1, 1993, the text "Senior Staff" is appended to the Notes field. - +> [!NOTE] +> The **PercentPosition** property is only an approximation and should not be used as a critical parameter. This property is best suited for driving an indicator that marks a user's progress while moving though a set of records. For example, you may want a control that indicates the percentage of records completed. +The following example opens a **Recordset** object on a table called Employees. The procedure then moves through the Employees table and uses the **[SysCmd](../../../api/Access.Application.SysCmd.md)** method to display a progress bar showing the percentage of the table that has been processed. If the hire date of the employee is before Jan. 1, 1993, the text "Senior Staff" is appended to the Notes field. ```vb Sub AddEmployeeNotes() diff --git a/access/Concepts/Data-Access-Objects/make-bulk-changes-to-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/make-bulk-changes-to-a-dao-recordset.md index efbb47c9398..0cb59d305f3 100644 --- a/access/Concepts/Data-Access-Objects/make-bulk-changes-to-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/make-bulk-changes-to-a-dao-recordset.md @@ -1,18 +1,16 @@ --- -title: Make Bulk Changes to a DAO Recordset +title: Make bulk changes to a DAO Recordset ms.prod: access ms.assetid: b66c857a-42ed-15c9-e01d-99c451651f3b -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Make Bulk Changes to a DAO Recordset - -After you have created a table-type or dynaset-type **[Recordset](../../../api/overview/Access.md)** object, you can change, delete, or add new records. You cannot change, delete, or add records to a snapshot-type or forward-only-type **Recordset** object. - -Many of the changes you may otherwise perform in a loop can be done more efficiently with an update or delete query using SQL. The following example creates a **[QueryDef](../../../api/overview/Access.md)** object to update the Employees table and then runs the query. +# Make bulk changes to a DAO Recordset +After you have created a table-type or dynaset-type **[Recordset](../../../api/overview/Access.md)** object, you can change, delete, or add new records. You cannot change, delete, or add records to a snapshot-type or forward-only-type **Recordset** object. +Many of the changes you may otherwise perform in a loop can be done more efficiently with an update or delete query using SQL. The following example creates a **[QueryDef](../../../api/overview/Access.md)** object to update the Employees table and then runs the query. ```vb Dim dbsNorthwind As DAO.Database @@ -66,6 +64,7 @@ Dim strNew As String ``` - **Note** A delete query is much more efficient than code that loops through a **Recordset**, modifying or deleting one record at a time. +> [!NOTE] +> A delete query is much more efficient than code that loops through a **Recordset**, modifying or deleting one record at a time. diff --git a/access/Concepts/Data-Access-Objects/manipulate-multivalued-fields-with-dao.md b/access/Concepts/Data-Access-Objects/manipulate-multivalued-fields-with-dao.md index 699580d2df3..7ab827b4658 100644 --- a/access/Concepts/Data-Access-Objects/manipulate-multivalued-fields-with-dao.md +++ b/access/Concepts/Data-Access-Objects/manipulate-multivalued-fields-with-dao.md @@ -1,14 +1,14 @@ --- -title: Manipulate Multivalued Fields With DAO +title: Manipulate multivalued fields with DAO ms.prod: access ms.assetid: a3c02fcd-ad48-c3fb-afa1-aabb43fc5bbf -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Manipulate Multivalued Fields With DAO +# Manipulate multivalued fields with DAO -Multivalued fields are represented as **[Recordset](../../../api/overview/Access.md)** objects in DAO. The recordset for a field is a child of the recordset for the table that contains the multivalued field. To instantiate the child recordset, use the **Value** property of the multivalued field as follows. +Multivalued fields are represented as **[Recordset](../../../api/overview/Access.md)** objects in DAO. The recordset for a field is a child of the recordset for the table that contains the multivalued field. To instantiate the child recordset, use the **Value** property of the multivalued field as follows. ```vb @@ -18,19 +18,15 @@ Set childRs = rs..Value The following code example shows how to instantiate the child recordset of the AssignedTo field of the Tasks table. - - - ```vb Set rs = db.OpenRecordSet("Tasks") Set childRs = rs.AssignedTo.Value ``` -The child recordset has the same functionality as any DAO **Recordset** object. -The following code example shows how to iterate through a parent recordset and its child recordset. The example prints the tasks in the Tasks table along with the people assigned to the tasks to the Immediate window. - +The child recordset has the same functionality as any DAO **Recordset** object. +The following code example shows how to iterate through a parent recordset and its child recordset. The example prints the tasks in the Tasks table along with the people assigned to the tasks to the Immediate window. ```vb Sub BrowseMultiValueField() diff --git a/access/Concepts/Data-Access-Objects/mark-a-position-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/mark-a-position-in-a-dao-recordset.md index 21e4802bdc6..8cba9697592 100644 --- a/access/Concepts/Data-Access-Objects/mark-a-position-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/mark-a-position-in-a-dao-recordset.md @@ -1,16 +1,16 @@ --- -title: Mark a Position in a DAO Recordset +title: Mark a position in a DAO Recordset ms.prod: access ms.assetid: 52e378ab-0e03-cc5f-b215-834efe0f2667 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Mark a Position in a DAO Recordset +# Mark a position in a DAO Recordset -A bookmark is a system-generated Byte array that uniquely identifies each record. The DAO **[Bookmark](../../../api/overview/Access.md)** property of a **[Recordset](../../../api/overview/Access.md)** object changes each time you move to a new record. To identify a record, move to that record and then assign the value of the DAO **Bookmark** property to a variable of type Variant. To return to the record, set the DAO **Bookmark** property to the value of the variable. +A bookmark is a system-generated Byte array that uniquely identifies each record. The DAO **[Bookmark](../../../api/overview/Access.md)** property of a **[Recordset](../../../api/overview/Access.md)** object changes each time you move to a new record. To identify a record, move to that record and then assign the value of the DAO **Bookmark** property to a variable of type Variant. To return to the record, set the DAO **Bookmark** property to the value of the variable. -The following code example shows how to find the product that makes the most and least revenue per category by using a bookmark to save the current record position. By using a bookmark, you can perform other operations on the **Recordset** object, and then return to the saved record position. +The following code example shows how to find the product that makes the most and least revenue per category by using a bookmark to save the current record position. By using a bookmark, you can perform other operations on the **Recordset** object, and then return to the saved record position. @@ -113,20 +113,17 @@ ErrorHandler: End Sub ``` -A bookmark is useful if a method fails because the current record position is undefined. -The **[LastModified](../../../api/overview/Access.md)** property of the **Recordset** object provides a good illustration of how to use a bookmark. The **LastModified** property returns the bookmark of the last record in the **Recordset** to be added or modified. To use it, set the DAO **Bookmark** property equal to the **LastModified** property, as follows. - - +A bookmark is useful if a method fails because the current record position is undefined. The **[LastModified](../../../api/overview/Access.md)** property of the **Recordset** object provides a good illustration of how to use a bookmark. The **LastModified** property returns the bookmark of the last record in the **Recordset** to be added or modified. To use it, set the DAO **Bookmark** property equal to the **LastModified** property, as follows. ```vb rstCustomers.Bookmark = rstCustomers.LastModified ``` -This moves the current record position to the last record that was added or modified. This is particularly useful when adding new records, because after you add a new record, the current record is the one you were on before you added the record. With the **LastModified** property, you can move to the newly added record if that is what your application expects. -When you close a **Recordset** object, any bookmarks you saved become invalid. You cannot use a bookmark from one **Recordset** in another **Recordset**, even if both **Recordset** objects are based on the same underlying table or query. However, you can use a bookmark on the clone of a **Recordset**, as shown in the following example. - +This moves the current record position to the last record that was added or modified. This is particularly useful when adding new records, because after you add a new record, the current record is the one you were on before you added the record. With the **LastModified** property, you can move to the newly added record if that is what your application expects. +When you close a **Recordset** object, any bookmarks you saved become invalid. +You cannot use a bookmark from one **Recordset** in another **Recordset**, even if both **Recordset** objects are based on the same underlying table or query. However, you can use a bookmark on the clone of a **Recordset**, as shown in the following example. ```vb Dim dbsNorthwind As DAO.Database @@ -152,8 +149,9 @@ Dim varBookMark As Variant ``` -You can also use the DAO **Bookmark** property on the **Recordset** object underlying a form. With this property, your code can mark which record is currently displayed on the form, and then change the record that is being displayed. For example, on a form containing employee information, you may want to include a button that a user can click to show the record for an employee's supervisor. +You can also use the DAO **Bookmark** property on the **Recordset** object underlying a form. With this property, your code can mark which record is currently displayed on the form, and then change the record that is being displayed. For example, on a form containing employee information, you may want to include a button that a user can click to show the record for an employee's supervisor. - **Note** Dynasets based on certain linked tables, such as Paradox tables that have no primary key, do not support bookmarks, nor do forward-only-type **Recordset** objects. You can determine whether a given **Recordset** object supports bookmarks by checking the value of the **[Bookmarkable](../../../api/overview/Access.md)** property. +> [!NOTE] +> Dynasets based on certain linked tables, such as Paradox tables that have no primary key, do not support bookmarks, nor do forward-only-type **Recordset** objects. You can determine whether a given **Recordset** object supports bookmarks by checking the value of the **[Bookmarkable](../../../api/overview/Access.md)** property. diff --git a/access/Concepts/Data-Access-Objects/modify-a-query-from-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/modify-a-query-from-a-dao-recordset.md index 5749c6b956b..2a9db90b14d 100644 --- a/access/Concepts/Data-Access-Objects/modify-a-query-from-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/modify-a-query-from-a-dao-recordset.md @@ -1,16 +1,16 @@ --- -title: Modify a Query from a DAO Recordset +title: Modify a query from a DAO Recordset ms.prod: access ms.assetid: b5679ca8-9bcd-2d28-15af-2640db727dd4 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Modify a Query from a DAO Recordset +# Modify a query from a DAO Recordset -You can use the **[Requery](../../../api/overview/Access.md)** method on a dynaset-type or snapshot-type **[Recordset](../../../api/overview/Access.md)** object when you want to run the underlying query again after changing a parameter. This is more convenient than opening a new **Recordset**, and it runs faster. +You can use the **[Requery](../../../api/overview/Access.md)** method on a dynaset-type or snapshot-type **[Recordset](../../../api/overview/Access.md)** object when you want to run the underlying query again after changing a parameter. This is more convenient than opening a new **Recordset**, and it runs faster. -The following code example creates a **Recordset** object and passes it to a function that uses the **[CopyQueryDef](../../../api/overview/Access.md)** method to extract the equivalent SQL string. It then prompts the user to add an additional constraint clause to the query. The code uses the **Requery** method to run the modified query. +The following code example creates a **Recordset** object and passes it to a function that uses the **[CopyQueryDef](../../../api/overview/Access.md)** method to extract the equivalent SQL string. It then prompts the user to add an additional constraint clause to the query. The code uses the **Requery** method to run the modified query. @@ -91,7 +91,7 @@ ErrorHandler: End Sub ``` - - **Note** To use the **Requery** method, the **[Restartable](../../../api/overview/Access.md)** property of the **Recordset** object must be set to **True**. The **Restartable** property is always set to **True** when the **Recordset** is created from a query other than a crosstab query against tables in an Access database. You cannot restart SQL pass-through queries. You may or may not be able to restart queries against linked tables in another database format. To determine whether a **Recordset** object can rerun its query, check the **Restartable** property. +> [!NOTE] +> To use the **Requery** method, the **[Restartable](../../../api/overview/Access.md)** property of the **Recordset** object must be set to **True**. The **Restartable** property is always set to **True** when the **Recordset** is created from a query other than a crosstab query against tables in an Access database. You cannot restart SQL pass-through queries. You may or may not be able to restart queries against linked tables in another database format. To determine whether a **Recordset** object can rerun its query, check the **Restartable** property. diff --git a/access/Concepts/Data-Access-Objects/modify-an-existing-record-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/modify-an-existing-record-in-a-dao-recordset.md index 0783f298b5d..391244fce2b 100644 --- a/access/Concepts/Data-Access-Objects/modify-an-existing-record-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/modify-an-existing-record-in-a-dao-recordset.md @@ -1,29 +1,27 @@ --- -title: Modify an Existing Record in a DAO Recordset +title: Modify an existing record in a DAO Recordset ms.prod: access ms.assetid: e1fe83cc-db41-8c51-1809-e5ae059c0260 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Modify an Existing Record in a DAO Recordset +# Modify an existing record in a DAO Recordset -You can modify existing records in a table-type or dynaset-type **[Recordset](../../../api/overview/Access.md)** object by using the **[Edit](../../../api/overview/Access.md)** and **[Update](../../../api/overview/Access.md)** methods. +You can modify existing records in a table-type or dynaset-type **[Recordset](../../../api/overview/Access.md)** object by using the **[Edit](../../../api/overview/Access.md)** and **[Update](../../../api/overview/Access.md)** methods. -To modify an existing record in a table-type or dynaset-type **Recordset** object: +To modify an existing record in a table-type or dynaset-type **Recordset** object: 1. Go to the record that you want to change. -2. Use the **Edit** method to prepare the current record for editing. +2. Use the **Edit** method to prepare the current record for editing. 3. Make the necessary changes to the record. -4. Use the **Update** method to save the changes to the current record. +4. Use the **Update** method to save the changes to the current record. The following code example shows how to change the job titles for all sales representatives in a table called Employees. - - ```vb Dim dbsNorthwind As DAO.Database Dim rstEmployees As DAO.Recordset @@ -44,7 +42,8 @@ Dim rstEmployees As DAO.Recordset ``` - **Note** If you do not use the **Edit** method before you try to change a value in the current record, a run-time error occurs. If you edit the current record and then move to another record or close the **Recordset** object without first using the **Update** method, your changes are lost without warning. For example, omitting the **Update** method from the preceding example results in no changes being made to the Employees table. - -You can also terminate the **Edit** method and any pending transactions without saving changes by using the **[CancelUpdate](../../../api/overview/Access.md)** method. While you can terminate the **Edit** method just by moving off the current record, this is not practical when the current record is the first or last record in the **Recordset**, or when it is a new record. It is generally simpler to use the **CancelUpdate** method. +> [!NOTE] +> If you do not use the **Edit** method before you try to change a value in the current record, a run-time error occurs. If you edit the current record and then move to another record or close the **Recordset** object without first using the **Update** method, your changes are lost without warning. For example, omitting the **Update** method from the preceding example results in no changes being made to the Employees table. +> +> You can also terminate the **Edit** method and any pending transactions without saving changes by using the **[CancelUpdate](../../../api/overview/Access.md)** method. While you can terminate the **Edit** method just by moving off the current record, this is not practical when the current record is the first or last record in the **Recordset**, or when it is a new record. It is generally simpler to use the **CancelUpdate** method. diff --git a/access/Concepts/Data-Access-Objects/move-through-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/move-through-a-dao-recordset.md index b2ddb92658c..af4b921c762 100644 --- a/access/Concepts/Data-Access-Objects/move-through-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/move-through-a-dao-recordset.md @@ -1,31 +1,30 @@ --- -title: Move Through a DAO Recordset +title: Move through a DAO Recordset ms.prod: access ms.assetid: 7d788b60-c6e8-dea7-68fe-01b893fc3374 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Move Through a DAO Recordset +# Move through a DAO Recordset -A **[Recordset](../../../api/overview/Access.md)** object usually has a current position, most often at a record. When you refer to the fields in a **Recordset**, you obtain values from the record at the current position, which is known as the current record. However, the current position can also be immediately before the first record in a **Recordset** or immediately after the last record. In certain circumstances, the current position is undefined. +A **[Recordset](../../../api/overview/Access.md)** object usually has a current position, most often at a record. When you refer to the fields in a **Recordset**, you obtain values from the record at the current position, which is known as the current record. However, the current position can also be immediately before the first record in a **Recordset** or immediately after the last record. In certain circumstances, the current position is undefined. -You can use the following **Move** methods to loop through the records in a **Recordset**: +You can use the following **Move** methods to loop through the records in a **Recordset**: -- The **[MoveFirst](../../../api/overview/Access.md)** method moves to the first record. +- The **[MoveFirst](../../../api/overview/Access.md)** method moves to the first record. -- The **[MoveLast](../../../api/overview/Access.md)** method moves to the last record. +- The **[MoveLast](../../../api/overview/Access.md)** method moves to the last record. -- The **[MoveNext](../../../api/overview/Access.md)** method moves to the next record. +- The **[MoveNext](../../../api/overview/Access.md)** method moves to the next record. -- The **[MovePrevious](../../../api/overview/Access.md)** method moves to the previous record. +- The **[MovePrevious](../../../api/overview/Access.md)** method moves to the previous record. -- The **[Move](../../../api/overview/Access.md)** method moves forward or backward the number of records you specify in its syntax. +- The **[Move](../../../api/overview/Access.md)** method moves forward or backward the number of records you specify in its syntax. -You can use each of these methods on table-type, dynaset-type, and snapshot-type **Recordset** objects. On a forward-only-type **Recordset** object, you can use only the **MoveNext** and **Move** methods. If you use the **Move** method on a forward-only-type **Recordset**, the argument specifying the number of rows to move must be a positive integer. -The following code example opens a **Recordset** object on the Employees table containing all of the records that have a **Null** value in the ReportsTo field. The function then updates the records to indicate that these employees are temporary employees. For each record in the **Recordset**, the example changes the Title and Notes fields, and saves the changes with the **[Update](../../../api/overview/Access.md)** method. It uses the **MoveNext** method to move to the next record. - +You can use each of these methods on table-type, dynaset-type, and snapshot-type **Recordset** objects. On a forward-only-type **Recordset** object, you can use only the **MoveNext** and **Move** methods. If you use the **Move** method on a forward-only-type **Recordset**, the argument specifying the number of rows to move must be a positive integer. +The following code example opens a **Recordset** object on the Employees table containing all of the records that have a **Null** value in the ReportsTo field. The function then updates the records to indicate that these employees are temporary employees. For each record in the **Recordset**, the example changes the Title and Notes fields, and saves the changes with the **[Update](../../../api/overview/Access.md)** method. It uses the **MoveNext** method to move to the next record. ```vb Sub UpdateEmployees() @@ -73,7 +72,7 @@ ErrorHandler: End Sub ``` - - **Note** The previous example is provided only for the purposes of illustrating the **Update** and **MoveNext** methods. For optimal performance, it is recommended that you perform this bulk operation with a SQL UPDATE query. +> [!NOTE] +> The previous example is provided only for the purposes of illustrating the **Update** and **MoveNext** methods. For optimal performance, it is recommended that you perform this bulk operation with a SQL UPDATE query. diff --git a/access/Concepts/Data-Access-Objects/read-from-and-write-to-a-field-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/read-from-and-write-to-a-field-in-a-dao-recordset.md index 6b97959bb68..77af9155bf3 100644 --- a/access/Concepts/Data-Access-Objects/read-from-and-write-to-a-field-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/read-from-and-write-to-a-field-in-a-dao-recordset.md @@ -1,14 +1,14 @@ --- -title: Read From and Write To a Field in a DAO Recordset +title: Read from and write to a field in a DAO Recordset ms.prod: access ms.assetid: 4fe0c334-9c44-773c-7aed-182b042213a7 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Read From and Write To a Field in a DAO Recordset +# Read from and write to a field in a DAO Recordset -When you read or write data to a field, you are actually reading or setting the DAO **[Value](../../../api/overview/Access.md)** property of a **[Field](../../../api/overview/Access.md)** object. The DAO **Value** property is the default property of a **Field** object. Therefore, you can set the DAO **Value** property of the LastName field in the rstEmployees **[Recordset](../../../api/overview/Access.md)** in any of the following ways. +When you read or write data to a field, you are actually reading or setting the DAO **[Value](../../../api/overview/Access.md)** property of a **[Field](../../../api/overview/Access.md)** object. The DAO **Value** property is the default property of a **Field** object. Therefore, you can set the DAO **Value** property of the LastName field in the rstEmployees **[Recordset](../../../api/overview/Access.md)** in any of the following ways. ```vb @@ -19,9 +19,9 @@ rstEmployees![LastName] = strName ``` -The tables underlying a **Recordset** object may not permit you to modify data, even though the **Recordset** is of type dynaset or table, which are usually updatable. Check the **[Updatable](../../../api/overview/Access.md)** property of the **Recordset** to determine whether its data can be changed. If the property is **True**, the **Recordset** object can be updated. +The tables underlying a **Recordset** object may not permit you to modify data, even though the **Recordset** is of type dynaset or table, which are usually updatable. Check the **[Updatable](../../../api/overview/Access.md)** property of the **Recordset** to determine whether its data can be changed. If the property is **True**, the **Recordset** object can be updated. -Individual fields within an updatable **Recordset** object may not be updatable, and trying to write to these fields generates a run-time error. To determine whether a given field is updatable, check the **[DataUpdatable](../../../api/overview/Access.md)** property of the corresponding **Field** object in the **[Fields](../../../api/overview/Access.md)** collection of the **Recordset**. The following example returns **True** if all fields in the dynaset created by strQuery are updatable and returns **False** otherwise. +Individual fields within an updatable **Recordset** object may not be updatable, and trying to write to these fields generates a run-time error. To determine whether a given field is updatable, check the **[DataUpdatable](../../../api/overview/Access.md)** property of the corresponding **Field** object in the **[Fields](../../../api/overview/Access.md)** collection of the **Recordset**. The following example returns **True** if all fields in the dynaset created by strQuery are updatable and returns **False** otherwise. @@ -68,10 +68,14 @@ ErrorHandler: End Function ``` -Any single field can impose a number of criteria on data in that field when records are added or updated. These criteria are defined by a handful of properties. The DAO **[AllowZeroLength](../../../api/overview/Access.md)** property on a Text or Memo field indicates whether or not the field will accept a zero-length string (""). The DAO **[Required](../../../api/overview/Access.md)** property indicates whether or not some value must be entered in the field, or if it instead can accept a **Null** value. For a **Field** object on a **Recordset**, these properties are read-only; their state is determined by the underlying table. -Validation is the process of determining whether data entered into a field's DAO **Value** property is within an acceptable range. A **Field** object on a **Recordset** may have the DAO **[ValidationRule](../../../api/overview/Access.md)** and **[ValidationText](../../../api/overview/Access.md)** properties set. The DAO **ValidationRule** property is simply a criteria expression, similar to the criteria of an SQL WHERE clause, without the WHERE keyword. The DAO **ValidationText** property is a string that Access displays in an error message if you try to enter data in the field that is outside the limits of the DAO **ValidationRule** property. If you are using DAO in your code, then you can use the DAO **ValidationText** for a message that you want to display to the user. +Any single field can impose a number of criteria on data in that field when records are added or updated. These criteria are defined by a handful of properties. The DAO **[AllowZeroLength](../../../api/overview/Access.md)** property on a Text or Memo field indicates whether or not the field will accept a zero-length string (""). The DAO **[Required](../../../api/overview/Access.md)** property indicates whether or not some value must be entered in the field, or if it instead can accept a **Null** value. For a **Field** object on a **Recordset**, these properties are read-only; their state is determined by the underlying table. - **Note** The DAO **ValidationRule** and **ValidationText** properties also exist at the **Recordset** level. These are read-only properties, reflecting the table-level validation scheme established on the table from which the current record is retrieved. +Validation is the process of determining whether data entered into a field's DAO **Value** property is within an acceptable range. A **Field** object on a **Recordset** may have the DAO **[ValidationRule](../../../api/overview/Access.md)** and **[ValidationText](../../../api/overview/Access.md)** properties set. The DAO **ValidationRule** property is simply a criteria expression, similar to the criteria of an SQL WHERE clause, without the WHERE keyword. The DAO **ValidationText** property is a string that Access displays in an error message if you try to enter data in the field that is outside the limits of the DAO **ValidationRule** property. If you are using DAO in your code, then you can use the DAO **ValidationText** for a message that you want to display to the user. -A **Field** object on a **Recordset** also features the **[ValidateOnSet](../../../api/overview/Access.md)** property. When the **ValidateOnSet** property is set to **True**, Access checks validation as soon as the field's DAO **Value** property is set. When it is set to **False** (the default), Access checks validation only when the completed record is updated. For example, if you are adding data to a record that contains a large Memo or OLE Object field and that has the DAO **ValidationRule** property set, you should determine whether the new data violates the validation rule before trying to write the data. To do so, set the **ValidateOnSet** property to **True**. If you wait to check validation until the entire record is written to disk, you may waste time trying to write an invalid record to disk. +> [!NOTE] +> The DAO **ValidationRule** and **ValidationText** properties also exist at the **Recordset** level. These are read-only properties, reflecting the table-level validation scheme established on the table from which the current record is retrieved. + +A **Field** object on a **Recordset** also features the **[ValidateOnSet](../../../api/overview/Access.md)** property. When the **ValidateOnSet** property is set to **True**, Access checks validation as soon as the field's DAO **Value** property is set. When it is set to **False** (the default), Access checks validation only when the completed record is updated. + +For example, if you are adding data to a record that contains a large Memo or OLE Object field and that has the DAO **ValidationRule** property set, you should determine whether the new data violates the validation rule before trying to write the data. To do so, set the **ValidateOnSet** property to **True**. If you wait to check validation until the entire record is written to disk, you may waste time trying to write an invalid record to disk. diff --git a/access/Concepts/Data-Access-Objects/return-a-random-record-from-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/return-a-random-record-from-a-dao-recordset.md index d73603f0e70..d365104f3dc 100644 --- a/access/Concepts/Data-Access-Objects/return-a-random-record-from-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/return-a-random-record-from-a-dao-recordset.md @@ -1,12 +1,12 @@ --- -title: Return a Random Record from a DAO Recordset +title: Return a random record from a DAO Recordset ms.prod: access ms.assetid: 16d8998f-0aca-a5e6-dec4-2be93c41a595 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Return a Random Record from a DAO Recordset +# Return a random record from a DAO Recordset Access does not have a built-in mechanism for returning a random record from a set of records. This topic describes a sample user-defined function that you can use to return a random record. diff --git a/access/Concepts/Data-Access-Objects/set-properties-of-data-access-objects-in-visual-basic.md b/access/Concepts/Data-Access-Objects/set-properties-of-data-access-objects-in-visual-basic.md index 744169c356a..fcfc6c2bf50 100644 --- a/access/Concepts/Data-Access-Objects/set-properties-of-data-access-objects-in-visual-basic.md +++ b/access/Concepts/Data-Access-Objects/set-properties-of-data-access-objects-in-visual-basic.md @@ -1,23 +1,23 @@ --- -title: Set Properties of Data Access Objects in Visual Basic +title: Set properties of Data Access Objects in Visual Basic keywords: vbaac10.chm5188066 f1_keywords: - vbaac10.chm5188066 ms.prod: access ms.assetid: 8942307f-950d-f39d-cab2-ba4fa387b438 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Set Properties of Data Access Objects in Visual Basic +# Set properties of Data Access Objects in Visual Basic **Applies to:** Access 2013 | Access 2016 -Data Access Objects (DAO) enable you to manipulate the structure of your database and the data it contains from Visual Basic. Many DAO objects correspond to objects that you see in your database — for example, a **TableDef** object corresponds to a Microsoft Access table. A **Field** object corresponds to a field in a table. +Data Access Objects (DAO) enable you to manipulate the structure of your database and the data it contains from Visual Basic. Many DAO objects correspond to objects that you see in your database—for example, a **TableDef** object corresponds to a Microsoft Access table. A **Field** object corresponds to a field in a table. Most of the properties you can set for DAO objects are DAO properties. These properties are defined by the Microsoft Access database engine and are set the same way in any application that includes the Access database engine. Some properties that you can set for DAO objects are defined by Microsoft Access, and aren't automatically recognized by the Access database engine. How you set properties for DAO objects depends on whether a property is defined by the Access database engine or by Microsoft Access. -## Setting DAO Properties for DAO Objects +## Set DAO properties for DAO objects To set a property that's defined by the Access database engine, refer to the object in the DAO hierarchy. The easiest and fastest way to do this is to create object variables that represent the different objects you need to work with, and refer to the object variables in subsequent steps in your code. For example, the following code creates a new **TableDef** object and sets its **Name** property: @@ -31,7 +31,7 @@ tdf.Name = "Contacts" ``` -## Setting Microsoft Access Properties for DAO Objects +## Set Microsoft Access properties for DAO objects When you set a property that's defined by Microsoft Access, but applies to a DAO object, the Access database engine doesn't automatically recognize the property as a valid property. The first time you set the property, you must create the property and append it to the **Properties** collection of the object to which it applies. Once the property is in the **Properties** collection, it can be set in the same manner as any DAO property. @@ -41,34 +41,30 @@ When writing procedures to set properties defined by Microsoft Access, you shoul Keep in mind that when you create the property, you must correctly specify its **Type** property before you append it to the **Properties** collection. You can determine the **Type** property based on the information in the Settings section of the Help topic for the individual property. The following table provides some guidelines for determining the setting of the **Type** property. - - -|**If the property setting is**|**Then the Type property setting should be**| +|**If the property setting is**|**The Type property setting should be**| |:-----|:-----| |A string|**dbText**| |**True** / **False**|**dbBoolean**| |An integer|**dbInteger**| -The following table lists some Microsoft Access-defined properties that apply to DAO objects. - +
+The following table lists some Microsoft Access-defined properties that apply to DAO objects. |**DAO object**|**Microsoft Access-defined properties**| |:-----|:-----| |**Database**|**AppTitle**, **AppIcon**, **StartupShowDBWindow**, **StartupShowStatusBar**, **AllowShortcutMenus**, **AllowFullMenus**, **AllowBuiltInToolbars**, **AllowToolbarChanges**, **AllowBreakIntoCode**, **AllowSpecialKeys**, **Replicable**, **ReplicationConflictFunction**| -|SummaryInfo **Container**|**Title**, **Subject**, **Author**, **Manager**, **Company**, **Category**, **Keywords**, **Comments**, **Hyperlink Base** (See the **Summary** tab of the ** _DatabaseName_ Properties** dialog box, available by clicking **Database Properties** on the **File** menu.)| -|UserDefined **Container**|(See the **Summary** tab of the ** _DatabaseName_ Properties** dialog box, available by clicking **Database Properties** on the **File** menu.)| +|SummaryInfo **Container**|**Title**, **Subject**, **Author**, **Manager**, **Company**, **Category**, **Keywords**, **Comments**, **Hyperlink Base** (See the **Summary** tab of the **_DatabaseName_ Properties** dialog box, available by selecting **Database Properties** on the **File** menu.)| +|UserDefined **Container**|(See the **Summary** tab of the **_DatabaseName_ Properties** dialog box, available by selecting **Database Properties** on the **File** menu.)| |**TableDef**|**DatasheetBackColor**, **DatasheetCellsEffect**, **DatasheetFontHeight**, **DatasheetFontItalic**, **DatasheetFontName**, **DatasheetFontUnderline**, **DatasheetFontWeight**, **DatasheetForeColor**, **DatasheetGridlinesBehavior**, **DatasheetGridlinesColor**, **Description**, **FrozenColumns**, **RowHeight**, **ShowGrid**| |**QueryDef**|**DatasheetBackColor**, **DatasheetCellsEffect**, **DatasheetFontHeight**, **DatasheetFontItalic**, **DatasheetFontName**, **DatasheetFontUnderline**, **DatasheetFontWeight**, **DatasheetForeColor**, **DatasheetGridlinesBehavior**, **DatasheetGridlinesColor**, **Description**, **FailOnError**, **FrozenColumns**, **LogMessages**, **MaxRecords**, **RecordLocks**, **RowHeight**, **ShowGrid, UseTransaction**| |**Field**|**Caption**, **ColumnHidden**, **ColumnOrder**, **ColumnWidth**, **DecimalPlaces**, **Description**, **Format**, **InputMask**| ## See also -- [Access for developers forum on MSDN](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) - [Access help on support.office.com](https://support.office.com/search/results?query=Access) -- [Access help on answers.microsoft.com](https://answers.microsoft.com/en-us/office/forum/access?page=1&;tab=question&;status=all&;auth=1) -- [Search for specific Access error codes on Bing](https://www.bing.com/) - [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) -- [Access wiki on UtterAcess](https://www.utteraccess.com/forum/index.php?act=idx) - [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) -- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) \ No newline at end of file +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) + diff --git a/access/Concepts/Data-Access-Objects/sort-data-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/sort-data-in-a-dao-recordset.md index 65fd2e75b13..17b3e05fb78 100644 --- a/access/Concepts/Data-Access-Objects/sort-data-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/sort-data-in-a-dao-recordset.md @@ -1,20 +1,20 @@ --- -title: Sort Data in a DAO Recordset +title: Sort data in a DAO Recordset ms.prod: access ms.assetid: 900b0b00-34f5-dba6-5386-34360cee95a0 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Sort Data in a DAO Recordset +# Sort data in a DAO Recordset -Unless you open a table-type **[Recordset](../../../api/overview/Access.md)** object and set its **Index** property, you cannot be sure that records will appear in any specific order. However, you usually want to retrieve records in a specific order. For example, you may want to view invoices arranged by increasing invoice number, or retrieve employee records in alphabetical order by their last names. To see records in a specific order, sort them. +Unless you open a table-type **[Recordset](../../../api/overview/Access.md)** object and set its **Index** property, you cannot be sure that records will appear in any specific order. However, you usually want to retrieve records in a specific order. For example, you may want to view invoices arranged by increasing invoice number, or retrieve employee records in alphabetical order by their last names. To see records in a specific order, sort them. -To sort data in a **Recordset** object that is not a table, use an SQL ORDER BY clause in the query that constructs the **Recordset**. You can specify an SQL string when you create a **[QueryDef](../../../api/overview/Access.md)** object, when you create a stored query in a database, or when you use the **[OpenRecordset](../../../api/overview/Access.md)** method. +To sort data in a **Recordset** object that is not a table, use an SQL ORDER BY clause in the query that constructs the **Recordset**. You can specify an SQL string when you create a **[QueryDef](../../../api/overview/Access.md)** object, when you create a stored query in a database, or when you use the **[OpenRecordset](../../../api/overview/Access.md)** method. -You can also filter data, which means you restrict the result set returned by a query to records that meet some criteria. With any type of **OpenRecordset** object, use an SQL WHERE clause in the original query to filter data. +You can also filter data, which means you restrict the result set returned by a query to records that meet some criteria. With any type of **OpenRecordset** object, use an SQL WHERE clause in the original query to filter data. -The following code example opens a dynaset-type **Recordset** object, and uses an SQL statement to retrieve, filter, and sort records. +The following code example opens a dynaset-type **Recordset** object, and uses an SQL statement to retrieve, filter, and sort records. @@ -29,7 +29,7 @@ Set rstManagers = dbsNorthwind.OpenRecordset("SELECT FirstName, " & _ ``` -One limitation of running an SQL query in an **OpenRecordset** method is that it has to be recompiled every time you run it. If this query is used frequently, you can improve performance by first creating a stored query using the same SQL statement, and then opening a **Recordset** object against the query, as shown in the following code example. +One limitation of running an SQL query in an **OpenRecordset** method is that it has to be recompiled every time you run it. If this query is used frequently, you can improve performance by first creating a stored query using the same SQL statement, and then opening a **Recordset** object against the query, as shown in the following code example. diff --git a/access/Concepts/Data-Access-Objects/synchronize-a-dao-recordset-s-record-with-a-form-s-current-record.md b/access/Concepts/Data-Access-Objects/synchronize-a-dao-recordset-s-record-with-a-form-s-current-record.md index 2b7e311e3f5..623f8c4c54b 100644 --- a/access/Concepts/Data-Access-Objects/synchronize-a-dao-recordset-s-record-with-a-form-s-current-record.md +++ b/access/Concepts/Data-Access-Objects/synchronize-a-dao-recordset-s-record-with-a-form-s-current-record.md @@ -1,14 +1,16 @@ --- -title: Synchronize a DAO Recordset's Record with a Form's Current Record +title: Synchronize a DAO Recordset's record with a form's current record ms.prod: access ms.assetid: 2960dd7d-4c60-4148-ef58-dd44f1042851 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Synchronize a DAO Recordset's Record with a Form's Current Record +# Synchronize a DAO Recordset's record with a form's current record -The following code example uses the **[RecordsetClone](../../../api/Access.Form.RecordsetClone.md)** property and the **[Recordset](../../../api/overview/Access.md)** object to synchronize a recordset's record with the form's current record. When a company name is selected from a combo box, the **[FindFirst](../../../api/overview/Access.md)** method is used to locate the record for that company and the **Recordset** object's **[Bookmark](../../../api/overview/Access.md)** property is assigned to the form's **[Bookmark](../../../api/Access.Form.Bookmark.md)** property, causing the form to display the found record. +The following code example uses the **[RecordsetClone](../../../api/Access.Form.RecordsetClone.md)** property and the **[Recordset](../../../api/overview/Access.md)** object to synchronize a recordset's record with the form's current record. + +When a company name is selected from a combo box, the **[FindFirst](../../../api/overview/Access.md)** method is used to locate the record for that company, and the **Recordset** object's **[Bookmark](../../../api/overview/Access.md)** property is assigned to the form's **[Bookmark](../../../api/Access.Form.Bookmark.md)** property, causing the form to display the found record. ```vb diff --git a/access/Concepts/Data-Access-Objects/track-design-changes-to-a-table-type-dao-recordset.md b/access/Concepts/Data-Access-Objects/track-design-changes-to-a-table-type-dao-recordset.md index b50b03e47fc..86d94f8cf22 100644 --- a/access/Concepts/Data-Access-Objects/track-design-changes-to-a-table-type-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/track-design-changes-to-a-table-type-dao-recordset.md @@ -1,16 +1,16 @@ --- -title: Track Design Changes to a Table-Type DAO Recordset +title: Track design changes to a table-type DAO Recordset ms.prod: access ms.assetid: 540bfd6d-14f1-e0a2-8a2e-e09cb1a31d52 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Track Design Changes to a Table-Type DAO Recordset +# Track design changes to a table-type DAO Recordset -You may need to determine when the underlying **[TableDef](../../../api/overview/Access.md)** object of a table-type **[Recordset](../../../api/overview/Access.md)** was created, or the last time it was modified. The **[DateCreated](../../../api/overview/Access.md)** and **[LastUpdated](../../../api/overview/Access.md)** properties, respectively, give you this information. Both properties return the date stamp applied to the table by the machine on which the table resided at the time it was stamped. These properties are updated only when the table's design changes; they are not affected by changes to records in the table. +You may need to determine when the underlying **[TableDef](../../../api/overview/Access.md)** object of a table-type **[Recordset](../../../api/overview/Access.md)** was created, or the last time it was modified. The **[DateCreated](../../../api/overview/Access.md)** and **[LastUpdated](../../../api/overview/Access.md)** properties, respectively, give you this information. Both properties return the date stamp applied to the table by the machine on which the table resided at the time it was stamped. These properties are updated only when the table's design changes; they are not affected by changes to records in the table. -The following code example shows the **DateCreated** and **LastUpdated** properties by adding a new **[Field](../../../api/overview/Access.md)** to an existing **TableDef** and by creating a new **TableDef**. The **DateOutput** function is required for this procedure to run. +The following code example shows the **DateCreated** and **LastUpdated** properties by adding a new **[Field](../../../api/overview/Access.md)** to an existing **TableDef** and by creating a new **TableDef**. The **DateOutput** function is required for this procedure to run. diff --git a/access/Concepts/Data-Access-Objects/use-transactions-in-a-dao-recordset.md b/access/Concepts/Data-Access-Objects/use-transactions-in-a-dao-recordset.md index 12541085593..af49a47eb2e 100644 --- a/access/Concepts/Data-Access-Objects/use-transactions-in-a-dao-recordset.md +++ b/access/Concepts/Data-Access-Objects/use-transactions-in-a-dao-recordset.md @@ -1,12 +1,12 @@ --- -title: Use Transactions in a DAO Recordset +title: Use transactions in a DAO Recordset ms.prod: access ms.assetid: 7d565770-37b6-5650-c998-9ff3b30d54cb -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Use Transactions in a DAO Recordset +# Use transactions in a DAO Recordset A transaction is a set of operations bundled together and handled as a single unit of work. The work in a transaction must be completed as a whole; if any part of the transaction fails, the entire transaction fails. Transactions offer the developer the ability to enforce data integrity. With multiple database operations bundled into a single unit that must succeed or fail as a whole, the database cannot reach an inconsistent state. Transactions are common to most database management systems. @@ -14,11 +14,12 @@ The most common example of transaction processing involves a bank's automated te You should consider using transactions if you want to make sure that each operation in a group of operations is successful before all operations are committed. Keep in mind that all transactions are invisible to other transactions. That is, no transaction can see another transaction's updates to the database until the transaction is committed. +> [!NOTE] +> The behavior of transactions with Access databases differs from the behavior of ODBC data sources, such as SQL Server. For example, if a database is connected to a file server, and the file server stops before a transaction has had time to commit its changes, then your database could be left in an inconsistent state. If you require true transaction support with respect to durability, you should investigate using a client/server architecture. - **Note** The behavior of transactions with Access databases differs from the behavior of ODBC data sources, such as SQL Server. For example, if a database is connected to a file server, and the file server stops before a transaction has had time to commit its changes, then your database could be left in an inconsistent state. If you require true transaction support with respect to durability, you should investigate using a client/server architecture. +The Access databse engine supports transactions through the DAO **[BeginTrans](../../../api/overview/Access.md)**, **[CommitTrans](../../../api/overview/Access.md)**, and **[Rollback](../../../api/overview/Access.md)** methods of the **[Workspace](../../../api/overview/Access.md)** object. -The Access databse engine supports transactions through the DAO **[BeginTrans](../../../api/overview/Access.md)**, **[CommitTrans](../../../api/overview/Access.md)**, and **[Rollback](../../../api/overview/Access.md)** methods of the **[Workspace](../../../api/overview/Access.md)** object. -The following code example changes the job title of all sales representatives in the Employees table. After the **BeginTrans** method starts a transaction that isolates all of the changes made to the Employees table, the **CommitTrans** method saves the changes. Be aware that you can use the **Rollback** method to undo changes that you saved with the **[Update](../../../api/overview/Access.md)** method. +The following code example changes the job title of all sales representatives in the Employees table. After the **BeginTrans** method starts a transaction that isolates all of the changes made to the Employees table, the **CommitTrans** method saves the changes. Be aware that you can use the **Rollback** method to undo changes that you saved with the **[Update](../../../api/overview/Access.md)** method. @@ -66,6 +67,7 @@ ErrorHandler: End Sub ``` -When you use transactions, all databases and **[Recordset](../../../api/overview/Access.md)** objects in the specified **Workspace** object are affected; transactions are global to the workspace, not to a specific database or **Recordset**. If you perform operations on more than one database or within a workspace transaction, the **Commit** and **Rollback** methods affect all the objects changed within that workspace during the transaction. -You can also use the **[BeginTrans](../../../api/overview/Access.md)**, **[CommitTrans](../../../api/overview/Access.md)**, and **[Rollback](../../../api/overview/Access.md)** methods with the **[DBEngine](../../../api/overview/Access.md)** object. In this case, the transaction is applied to the default workspace, which is `DBEngine.Workspaces(0)`. +When you use transactions, all databases and **[Recordset](../../../api/overview/Access.md)** objects in the specified **Workspace** object are affected; transactions are global to the workspace, not to a specific database or **Recordset**. If you perform operations on more than one database or within a workspace transaction, the **Commit** and **Rollback** methods affect all the objects changed within that workspace during the transaction. + +You can also use the **[BeginTrans](../../../api/overview/Access.md)**, **[CommitTrans](../../../api/overview/Access.md)**, and **[Rollback](../../../api/overview/Access.md)** methods with the **[DBEngine](../../../api/overview/Access.md)** object. In this case, the transaction is applied to the default workspace, which is `DBEngine.Workspaces(0)`. diff --git a/access/Concepts/Data-Access-Objects/work-with-attachments-in-dao.md b/access/Concepts/Data-Access-Objects/work-with-attachments-in-dao.md index d495d69d439..c73fa206f0d 100644 --- a/access/Concepts/Data-Access-Objects/work-with-attachments-in-dao.md +++ b/access/Concepts/Data-Access-Objects/work-with-attachments-in-dao.md @@ -1,31 +1,29 @@ --- -title: Work With Attachments In DAO +title: Work with attachments in DAO ms.prod: access ms.assetid: e175a47a-4d97-b93b-c152-809314ac5ba0 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Work With Attachments In DAO +# Work with attachments in DAO -In DAO, Attachment fields function just like other multi-valued fields. The field that contains the attachment contains a recordset that is a child to the table's recordset. There are two new DAO methods, **[LoadFromFile](../../../api/overview/Access.md)** and **[SaveToFile](../../../api/overview/Access.md)**, that deal exclusively with attachments. +In DAO, Attachment fields function just like other multi-valued fields. The field that contains the attachment contains a recordset that is a child to the table's recordset. There are two new DAO methods, **[LoadFromFile](../../../api/overview/Access.md)** and **[SaveToFile](../../../api/overview/Access.md)**, that deal exclusively with attachments. -## Add an Attachment to a Record +## Add an attachment to a record -The **LoadFromFile** method loads a file from disk and adds the file as an attachment to the specified record. The following code example shows the syntax of the **LoadFromFile** method. +The **LoadFromFile** method loads a file from disk and adds the file as an attachment to the specified record. The following code example shows the syntax of the **LoadFromFile** method. ```vb Recordset.Fields("FileData").LoadFromFile() ``` +> [!NOTE] +> The **FileData** field is reserved internally by the Access database engine to store the binary attachment data. - **Note** The **FileData** field is reserved internally by the Access database engine to store the binary attachment data. - -The following code example uses the **LoadFromFile** method to load an employee's picture from disk. - - +The following code example uses the **LoadFromFile** method to load an employee's picture from disk. ```vb @@ -51,9 +49,9 @@ The following code example uses the **LoadFromFile** method to load an employee ``` -## Save an Attachment to Disk +## Save an attachment to disk -The following code example shows how to use the **SaveToFile** method to save all of the attachments for a specific employee to disk. +The following code example shows how to use the **SaveToFile** method to save all of the attachments for a specific employee to disk. ```vb diff --git a/access/Concepts/Date-Time/calculate-age.md b/access/Concepts/Date-Time/calculate-age.md index ccf713d5603..1daae0c7a22 100644 --- a/access/Concepts/Date-Time/calculate-age.md +++ b/access/Concepts/Date-Time/calculate-age.md @@ -1,19 +1,17 @@ --- -title: Calculate Age +title: Calculate age ms.prod: access ms.assetid: 4afca7f2-9864-6300-79c4-c4e251b0b66d -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Calculate Age +# Calculate age -Access does not include a function that will calculate the age of a person or thing based on a given date. This topic contains Visual Basic for Applications (VBA) code for two custom functions, **Age** and **AgeMonths**, that will calculate age based on a given date. +Access does not include a function that will calculate the age of a person or thing based on a given date. This topic contains Visual Basic for Applications (VBA) code for two custom functions, **Age** and **AgeMonths**, that will calculate age based on a given date. The following function calculates age in years from a given date to today's date. - - ```vb Function Age (varBirthDate As Variant) As Integer Dim varAge As Variant @@ -31,8 +29,6 @@ The following function calculates age in years from a given date to today's date The following function calculates the number of months that have transpired since the last month supplied by the given date. If the given date is a birthday, the function returns the number of months since the last birthday. - - ```vb Function AgeMonths(ByVal StartDate As String) As Integer Dim tAge As Double diff --git a/access/Concepts/Date-Time/calculate-and-display-specific-date-values.md b/access/Concepts/Date-Time/calculate-and-display-specific-date-values.md index 8a1eab93671..87c938a8dcf 100644 --- a/access/Concepts/Date-Time/calculate-and-display-specific-date-values.md +++ b/access/Concepts/Date-Time/calculate-and-display-specific-date-values.md @@ -1,101 +1,72 @@ --- -title: Calculate and Display Specific Date Values +title: Calculate and display specific date values +description: Create expressions and custom functions for displaying specific dates and calculating time intervals. ms.prod: access ms.assetid: ba8c8404-fbe9-d7ef-57bb-17631ec8fb4c -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Calculate and Display Specific Date Values +# Calculate and display specific date values Because a Date value is stored as a double-precision number, you may receive incorrect formatting results when you try to manipulate Date values in an expression. This topic illustrates how to create expressions and custom functions for displaying specific dates and calculating time intervals. -## Displaying Specific Dates - -The current month: - +#### Current month ```vb DateSerial(Year(Date()), Month(Date()), 1) ``` -The next month: - - - +#### Next month ```vb DateSerial(Year(Date()), Month(Date()) + 1, 1) ``` -The last day of the current month: - - - +#### Last day of the current month ```vb DateSerial(Year(Date()), Month(Date()) + 1, 0) ``` -The last day of the next month: - - - +#### Last day of the next month ```vb DateSerial(Year(Date()), Month(Date()) + 2, 0) ``` -The first day of the previous month: - - - +#### First day of the previous month ```vb DateSerial(Year(Date()), Month(Date())-1,1) ``` -The last day of the previous month: - - - +#### Last day of the previous month ```vb DateSerial(Year(Date()), Month(Date()),0) ``` -The first day of the current quarter: - - - +#### First day of the current quarter ```vb DateSerial(Year(Date()), Int((Month(Date()) - 1) / 3) * 3 + 1, 1) ``` -The last day of the current quarter: - - - +#### Last day of the current quarter ```vb DateSerial(Year(Date()), Int((Month(Date()) - 1) / 3) * 3 + 4, 0) ``` -The first day of the current week (assuming Sunday = day 1): - - - +#### First day of the current week (assuming Sunday = day 1) ```vb Date() - WeekDay(Date()) + 1 ``` -The last day of the current week: - - - +#### Last day of the current week ```vb Date() - WeekDay(Date()) + 7 diff --git a/access/Concepts/Date-Time/calculate-elapsed-time.md b/access/Concepts/Date-Time/calculate-elapsed-time.md index 84d80105bab..0207224a393 100644 --- a/access/Concepts/Date-Time/calculate-elapsed-time.md +++ b/access/Concepts/Date-Time/calculate-elapsed-time.md @@ -1,41 +1,37 @@ --- -title: Calculate Elapsed Time +title: Calculate elapsed time ms.prod: access ms.assetid: 90e46152-6d97-0860-a414-a17cc8ba40cf -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Calculate Elapsed Time +# Calculate elapsed time This topic explains how Access stores the Date/Time data type and why you may receive unexpected results when you calculate or compare dates and times. -## Storing Date/Time Data +## Store Date/Time data Access stores the Date/Time data type as a double-precision, floating-point number (up to 15 decimal places). The integer portion of the double-precision number represents the date; the decimal portion represents the time. -Valid date values range from -647,434 (January 1, 100 A.D.) to 2,958,465 (December 31, 9999 A.D.). A date value of 0 represents December 30, 1899. Access stores dates prior to December 30, 1899 as negative numbers. +Valid date values range from -647,434 (January 1, 100, A.D.) to 2,958,465 (December 31, 9999, A.D.). A date value of 0 represents December 30, 1899. Access stores dates prior to December 30, 1899, as negative numbers. Valid time values range from .0 (00:00:00) to .99999 (23:59:59). The numeric value represents a fraction of one day. You can convert the numeric value into hours, minutes, and seconds by multiplying the numeric value by 24. -|||||| +|**Double number**|**Date portion**|**Actual date**|**Time portion**|**Actual time**| |:-----|:-----|:-----|:-----|:-----| -|**Double Number**|**Date Portion**|**Actual Date**|**Time Portion**|**Actual Time**| |1.0|1|December 31,1899 |.0|12:00:00 A.M.| |2.5|2|January 1, 1900 |.5 |12:00:00 P.M.| |27468.96875|27468|March 15, 1975 |.96875 |11:15:00 P.M.| |33914.125 |33914|November 6, 1992||| -## Calculating Time Data +## Calculate time data Because a time value is stored as a fraction of a 24-hour day, you may receive incorrect formatting results when you calculate time intervals greater than 24 hours. To work around this behavior, you can create a user-defined function to ensure that time intervals are formatted correctly. -The following procedure illustrates how to use the **Format** function to format time intervals. The procedure accepts two time values and prints their the interval between them to the Immediate window in several different formats. - - - +The following procedure illustrates how to use the **Format** function to format time intervals. The procedure accepts two time values and prints their the interval between them to the Immediate window in several different formats. ```vb Function ElapsedTime(endTime As Date, startTime As Date) @@ -69,31 +65,26 @@ End Function ``` -## Comparing Date Data +## Compare date data -Because dates and times are stored together as double-precision numbers, you may receive unexpected results when you compare Date/Time data. For example, if you type the following expression in the Immediate window , you receive a **False** (0) result even if today's date is 7/11/2006: +Because dates and times are stored together as double-precision numbers, you may receive unexpected results when you compare Date/Time data. For example, if you type the following expression in the Immediate window , you receive a **False** (0) result even if today's date is 7/11/2006: ```vb ? Now()=DateValue("7/11/2006") ``` -The **[Now](../../../language/reference/User-Interface-Help/now-function.md)** function returns a double-precision number representing the current date and time. However, the **[DateValue](../../../language/reference/User-Interface-Help/datevalue-function.md)** function returns an integer number representing the date but not a fractional time value. As a result, **Now** equals **DateValue** only when **Now** returns a time of 00:00:00 (12:00:00 A.M.). +The **[Now](../../../language/reference/User-Interface-Help/now-function.md)** function returns a double-precision number representing the current date and time. However, the **[DateValue](../../../language/reference/User-Interface-Help/datevalue-function.md)** function returns an integer number representing the date but not a fractional time value. As a result, **Now** equals **DateValue** only when **Now** returns a time of 00:00:00 (12:00:00 A.M.). To receive accurate results when you compare date values, use one of the following functions. To test each function, type it in the Immediate window, substitute the current date for 7/11/2006, and then press ENTER: -To return an integer value, use the **[Date](../../../language/reference/User-Interface-Help/date-function.md)** function: - - - +To return an integer value, use the **[Date](../../../language/reference/User-Interface-Help/date-function.md)** function: ```vb ?Date()=DateValue("7/11/2006") ``` -To remove the fractional portion of the **Now** function, use the **[Int](../../../language/reference/User-Interface-Help/int-fix-functions.md)** function: - - +To remove the fractional portion of the **Now** function, use the **[Int](../../../language/reference/User-Interface-Help/int-fix-functions.md)** function: ```vb @@ -101,9 +92,9 @@ To remove the fractional portion of the **Now** function, use the **[Int](../.. ``` -## Comparing Time Data +## Compare time data -When you compare time values, you may receive inconsistent results because a time value is stored as the fractional portion of a double-precision, floating-point number. For example, if you type the following expression in the Immediate window, you receive a **False** (0) result even though the two time values look the same: +When you compare time values, you may receive inconsistent results because a time value is stored as the fractional portion of a double-precision, floating-point number. For example, if you type the following expression in the Immediate window, you receive a **False** (0) result even though the two time values look the same: ```vb @@ -112,25 +103,19 @@ var2 = DateAdd("n", 10, var1) ? var2 = #2:11:00 PM# ``` -When Access converts a time value to a fraction, the calculated result may not be the exact equivalent of the time value. The small difference caused by the calculation is enough to produce a **False** (0) result when you compare a stored value to a constant value. +When Access converts a time value to a fraction, the calculated result may not be the exact equivalent of the time value. The small difference caused by the calculation is enough to produce a **False** (0) result when you compare a stored value to a constant value. To receive accurate results when you compare time values, use one of the following methods. To test each method, type it in the Immediate window, and then press ENTER: Add an associated date to the time comparison: - - - ```vb var1 = #7/11/2006 2:00:00 PM# var2 = DateAdd("n", 10, var1) ? var2 = #7/11/2006 2:10:00 PM# ``` -Convert the time values to **String** data types before you compare them: - - - +Convert the time values to **String** data types before you compare them: ```vb var1 = #2:00:00 PM# @@ -138,10 +123,7 @@ var2 = DateAdd("n", 10, var1) ? CStr(var2) = CStr(#2:10:00 PM#) ``` -Use the **[DateDiff](../../../language/reference/User-Interface-Help/datediff-function.md)** function to compare precise units such as seconds: - - - +Use the **[DateDiff](../../../language/reference/User-Interface-Help/datediff-function.md)** function to compare precise units such as seconds: ```vb var1 = #2:00:00 PM# @@ -149,16 +131,21 @@ var2 = DateAdd("n", 10, var1) ? DateDiff("s", var2, #2:10:00 PM#) = 0 ``` - **Link provided by:** -![Community Member Icon](../../../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The[UtterAccess](https://www.utteraccess.com) community +### About the contributors + +**Link provided by** ![Community Member Icon](../../../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) the [UtterAccess](https://www.utteraccess.com) community. - [Summing elapsed time that could go over 24 hours](https://www.utteraccess.com/wiki/index.php/Summing_elapsed_time_that_could_go_over_24_hours) - -## About the Contributors - +UtterAccess is the premier Microsoft Access wiki and help forum. + +## See also -UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join. +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) diff --git a/access/Concepts/Date-Time/find-the-number-of-working-days-between-two-dates.md b/access/Concepts/Date-Time/find-the-number-of-working-days-between-two-dates.md index 9c56b731f48..e5dbfbdf061 100644 --- a/access/Concepts/Date-Time/find-the-number-of-working-days-between-two-dates.md +++ b/access/Concepts/Date-Time/find-the-number-of-working-days-between-two-dates.md @@ -1,17 +1,17 @@ --- -title: Find the Number of Working Days Between Two Dates +title: Find the number of working days between two dates ms.prod: access ms.assetid: 2831d409-1b10-06ef-54ec-9c3386e70021 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Find the Number of Working Days Between Two Dates +# Find the number of working days between two dates Access does not have a built-in function to determine the number of working days between two dates. The following user-defined function illustrates how to calculate the number of working days between two dates. - - **Note** This function does not account for holidays. +> [!NOTE] +> This function does not account for holidays. ```vb diff --git a/access/Concepts/Date-Time/format-dates-as-u-s-dates-regardless-of-regional-settings.md b/access/Concepts/Date-Time/format-dates-as-u-s-dates-regardless-of-regional-settings.md index 400a151fb41..b3917e3fa4c 100644 --- a/access/Concepts/Date-Time/format-dates-as-u-s-dates-regardless-of-regional-settings.md +++ b/access/Concepts/Date-Time/format-dates-as-u-s-dates-regardless-of-regional-settings.md @@ -1,14 +1,14 @@ --- -title: Format Dates as U.S. Dates Regardless of Regional Settings +title: Format dates as U.S. dates regardless of regional settings ms.prod: access ms.assetid: d2e9121d-d950-0f63-9a28-53613a205465 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Format Dates as U.S. Dates Regardless of Regional Settings +# Format dates as U.S. dates regardless of regional settings -When you use Visual Basic for Applications (VBA) to concatenate dates into an SQL string, you must use a standard U.S. date format, regardless of the region that you have set in the **Regional Settings** tool in **Control Panel**. This topic contains a custom function that will convert any date into a U.S. date format. +When you use Visual Basic for Applications (VBA) to concatenate dates into an SQL string, you must use a standard U.S. date format, regardless of the region that you have set in the **Regional Settings** tool in **Control Panel**. This topic contains a custom function that will convert any date into a U.S. date format. ```vb diff --git a/access/Concepts/Date-Time/specify-date-and-time-in-criteria-expressions.md b/access/Concepts/Date-Time/specify-date-and-time-in-criteria-expressions.md index 694dfd37d56..49d93fbd7e2 100644 --- a/access/Concepts/Date-Time/specify-date-and-time-in-criteria-expressions.md +++ b/access/Concepts/Date-Time/specify-date-and-time-in-criteria-expressions.md @@ -1,20 +1,19 @@ --- -title: Specify Date and Time in Criteria Expressions +title: Specify date and time in criteria expressions ms.prod: access ms.assetid: 749379e7-5fbe-3371-a780-ca7915d8de43 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Specify Date and Time in Criteria Expressions +# Specify date and time in criteria expressions To specify date or time criteria for an operation, you supply a date or time value as part of the string expression that forms the _criteria_ argument. This value must be enclosed in number signs (#). +> [!NOTE] +> The number signs indicate to Access that the _criteria_ argument contains a date or time within a string. - **Note** The number signs indicate to Access that the _criteria_ argument contains a date or time within a string. - - -Suppose that you are creating a filter for an Employees form to display records for all employees born on or after October 1, 1960. You could construct the _criteria_ argument for the form's **[Filter](../../../api/Access.Form.Filter(property).md)** or **[ServerFilter](../../../api/Access.Form.ServerFilter.md)** property, as shown in the following example. Note the format of the string expression - including the number signs - for the date to filter on. +Suppose that you are creating a filter for an Employees form to display records for all employees born on or after October 1, 1960. You could construct the _criteria_ argument for the form's **[Filter](../../../api/Access.Form.Filter(property).md)** or **[ServerFilter](../../../api/Access.Form.ServerFilter.md)** property, as shown in the following example. Note the format of the string expression—including the number signs—for the date to filter on. ```vb Forms!Employees.Filter = "[BirthDate] >= #10/1/1960#" diff --git a/access/Concepts/Error-Codes/comparison-of-data-types.md b/access/Concepts/Error-Codes/comparison-of-data-types.md index 822e765fc5b..635ffe7f355 100644 --- a/access/Concepts/Error-Codes/comparison-of-data-types.md +++ b/access/Concepts/Error-Codes/comparison-of-data-types.md @@ -1,19 +1,25 @@ --- -title: Comparison of Data Types +title: Comparison of data types keywords: vbaac10.chm5186571 f1_keywords: - vbaac10.chm5186571 ms.prod: access ms.assetid: b1e954f8-e407-ae13-e3d9-a24d3502290a -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Comparison of Data Types +# Comparison of data types -The Access database engine recognizes several overlapping sets of data types. In Access, there are four different contexts in which you may need to specify a data type — in table Design view, in the **Query Parameters** dialog box, in Visual Basic, and in SQL view in a query. +The Access database engine recognizes several overlapping sets of data types. In Access, there are four different contexts in which you may need to specify a data type—in table Design view, in the **Query Parameters** dialog box, in Visual Basic, and in SQL view in a query. -The following table compares the five sets of data types that correspond to each context. The first column lists the **Type** property settings available in table Design view and the five **FieldSize** property settings for the Number data type. The second column lists the corresponding query parameter data types available for designing parameter queries in the **Query Parameters** dialog box. The third column lists the corresponding Visual Basic data types. The fourth column lists ADO **Field** object data types. The fifth column lists the corresponding Jet database engine SQL data types defined by the Access database engine along with their valid synonyms. +The following table compares the five sets of data types that correspond to each context. + +- The first column lists the **Type** property settings available in table Design view and the five **FieldSize** property settings for the Number data type. +- The second column lists the corresponding query parameter data types available for designing parameter queries in the **Query Parameters** dialog box. +- The third column lists the corresponding Visual Basic data types. +- The fourth column lists ADO **Field** object data types. +- The fifth column lists the corresponding Jet database engine SQL data types defined by the Access database engine along with their valid synonyms. |**Table fields**|**Query parameters**|**Visual Basic**|**ADO Data Type property constants**|**Access database engine SQL and synonyms**| @@ -35,7 +41,10 @@ The following table compares the five sets of data types that correspond to each |Hyperlink|Memo|**String**|**adLongVarWChar**|

LONGTEXT

(Synonyms: LONGCHAR, MEMO, NOTE)

| | _Not supported_|Value|**Variant**|**adVariant**|VALUE (See Notes)| -|**Note**| -|:-----| -|
  • Access itself doesn't use the BINARY data type. It's recognized only for use in queries on linked tables from other database products that support the BINARY data type.
  • The INTEGER data type in the Access database engine SQL doesn't correspond to the **Integer** data type for table fields, query parameters, or Visual Basic. Instead, in SQL, the INTEGER data type corresponds to a **Long Integer** data type for table fields and query parameters and to a **Long** data type in Visual Basic.
  • The VALUE reserved word doesn't represent a data type defined by the Access database engine. However, in Access or SQL queries, the VALUE reserved word can be considered a valid synonym for the Visual Basic **Variant** data type.
  • If you are setting the data type for a DAO object in Visual Basic code, you must set the object's **Type** property.
| + +> [!NOTE] +> - Access itself doesn't use the BINARY data type. It's recognized only for use in queries on linked tables from other database products that support the BINARY data type. +> - The INTEGER data type in the Access database engine SQL doesn't correspond to the **Integer** data type for table fields, query parameters, or Visual Basic. Instead, in SQL, the INTEGER data type corresponds to a **Long Integer** data type for table fields and query parameters and to a **Long** data type in Visual Basic. +> - The VALUE reserved word doesn't represent a data type defined by the Access database engine. However, in Access or SQL queries, the VALUE reserved word can be considered a valid synonym for the Visual Basic **Variant** data type. +> - If you are setting the data type for a DAO object in Visual Basic code, you must set the object's **Type** property. diff --git a/access/Concepts/Error-Codes/custom-methods-and-properties.md b/access/Concepts/Error-Codes/custom-methods-and-properties.md index 18fe7ae494d..b7031a6527a 100644 --- a/access/Concepts/Error-Codes/custom-methods-and-properties.md +++ b/access/Concepts/Error-Codes/custom-methods-and-properties.md @@ -1,21 +1,21 @@ --- -title: Custom Methods and Properties +title: Custom methods and properties keywords: vbaac10.chm5187125 f1_keywords: - vbaac10.chm5187125 ms.prod: access ms.assetid: 2915eacb-240f-6876-0afb-1db038c4ecba -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Custom Methods and Properties +# Custom methods and properties You can use a class module to create a definition for a new custom object. When you create a new instance of a class, you create a new object and return a reference to it. -Any public procedures defined within the class module become methods of the new object. The **Sub** statement defines a method that doesn't return a value; the **Function** statement defines a method that may return a value of a specified type. +Any public procedures defined within the class module become methods of the new object. The **Sub** statement defines a method that doesn't return a value; the **Function** statement defines a method that may return a value of a specified type. -Any **Property Let**, **Property Get** or **Property Set** procedures you define become properties of the new object. **Property Get** procedures retrieve the value of a property. **Property Let** procedures set the value of a nonobject property. **Property Set** procedures set the value of an object property. +Any **Property Let**, **Property Get** or **Property Set** procedures you define become properties of the new object. **Property Get** procedures retrieve the value of a property. **Property Let** procedures set the value of a nonobject property. **Property Set** procedures set the value of an object property. For example, you can use a class module to create an interface layer between your application and a set of Windows application programming interface (API) functions that it calls. To do this, you create a set of simple procedures that call more complicated procedures in a DLL. When you create an instance of this class, the procedures you've created become methods of the new object. You can apply these methods as you would the methods of any object, and in doing so you also call the API functions. diff --git a/access/Concepts/Error-Codes/elements-of-run-time-error-handling.md b/access/Concepts/Error-Codes/elements-of-run-time-error-handling.md index 00af136cb6e..4c730f4fbfc 100644 --- a/access/Concepts/Error-Codes/elements-of-run-time-error-handling.md +++ b/access/Concepts/Error-Codes/elements-of-run-time-error-handling.md @@ -1,40 +1,38 @@ --- -title: Elements of Run-Time Error Handling +title: Elements of run-time error handling keywords: vbaac10.chm5186924 f1_keywords: - vbaac10.chm5186924 ms.prod: access ms.assetid: a0e06a1e-2709-aa51-92d0-340788a31a8a -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Elements of Run-Time Error Handling +# Elements of run-time error handling -## Errors and Error Handling +## Errors and error handling When you're programming an application, you need to consider what happens when an error occurs. An error can occur in your application for one of two of reasons. First, some condition at the time the application is running makes otherwise valid code fail. For example, if your code attempts to open a table that the user has deleted, an error occurs. Second, your code may contain improper logic that prevents it from doing what you intended. For example, an error occurs if your code attempts to divide a value by zero. If you've implemented no error handling, then Visual Basic halts execution and displays an error message when an error occurs in your code. The user of your application is likely to be confused and frustrated when this happens. You can forestall many problems by including thorough error-handling routines in your code to handle any error that may occur. -When adding error handling to a procedure, you should consider how the procedure will route execution when an error occurs. The first step in routing execution to an error handler is to enable an error handler by including some form of the **On Error** statement within the procedure. The **On Error** statement directs execution in event of an error. If there's no **On Error** statement, Visual Basic simply halts execution and displays an error message when an error occurs. +When adding error handling to a procedure, you should consider how the procedure will route execution when an error occurs. The first step in routing execution to an error handler is to enable an error handler by including some form of the **On Error** statement within the procedure. The **On Error** statement directs execution in event of an error. If there's no **On Error** statement, Visual Basic simply halts execution and displays an error message when an error occurs. -When an error occurs in a procedure with an enabled error handler, Visual Basic doesn't display the normal error message. Instead it routes execution to an error handler, if one exists. When execution passes to an enabled error handler, that error handler becomes active. Within the active error handler, you can determine the type of error that occurred and address it in the manner that you choose. Access provides three objects that contain information about errors that have occurred, the ADO **Error** object, the Visual Basic[Err Object](../../../language/reference/User-Interface-Help/err-object.md) **Err** object, and the DAO **Error** object. +When an error occurs in a procedure with an enabled error handler, Visual Basic doesn't display the normal error message. Instead it routes execution to an error handler, if one exists. When execution passes to an enabled error handler, that error handler becomes active. Within the active error handler, you can determine the type of error that occurred and address it in the manner that you choose. Access provides three objects that contain information about errors that have occurred, the ADO **Error** object, the Visual Basic **[Err](../../../language/reference/User-Interface-Help/err-object.md)** object, and the DAO **Error** object. -## Routing Execution When an Error Occurs +## Routing execution when an error occurs -An error handler specifies what happens within a procedure when an error occurs. For example, you may want the procedure to end if a certain error occurs, or you may want to correct the condition that caused the error and resume execution. The **On Error** and **Resume** statements determine how execution proceeds in the event of an error. +An error handler specifies what happens within a procedure when an error occurs. For example, you may want the procedure to end if a certain error occurs, or you may want to correct the condition that caused the error and resume execution. The **On Error** and **Resume** statements determine how execution proceeds in the event of an error. - _The On Error Statement_ +### On Error statement -The **On Error** statement enables or disables an error-handling routine. If an error-handling routine is enabled, execution passes to the error-handling routine when an error occurs. - -There are three forms of the **On Error** statement: **On Error GoTo** _label_, **On Error GoTo 0**, and **On Error Resume Next**. The **On Error GoTo** _label_ statement enables an error-handling routine, beginning with the line on which the statement is found. You should enable the error-handling routine before the first line at which an error could occur. When the error handler is active and an error occurs, execution passes to the line specified by the _label_ argument. - -The line specified by the _label_ argument should be the beginning of the error-handling routine. For example, the following procedure specifies that if an error occurs, execution passes to the line labeled : +The **On Error** statement enables or disables an error-handling routine. If an error-handling routine is enabled, execution passes to the error-handling routine when an error occurs. +There are three forms of the **On Error** statement: **On Error GoTo** _label_, **On Error GoTo 0**, and **On Error Resume Next**. The **On Error GoTo** _label_ statement enables an error-handling routine, beginning with the line on which the statement is found. You should enable the error-handling routine before the first line at which an error could occur. When the error handler is active and an error occurs, execution passes to the line specified by the _label_ argument. +The line specified by the _label_ argument should be the beginning of the error-handling routine. For example, the following procedure specifies that if an error occurs, execution passes to the line labeled: ```vb @@ -52,28 +50,25 @@ Error_MayCauseAnError: End Function ``` -The **On Error GoTo 0** statement disables error handling within a procedure. It doesn't specify line 0 as the start of the error-handling code, even if the procedure contains a line numbered 0. If there's no **On Error GoTo 0** statement in your code, the error handler is automatically disabled when the procedure has run completely. The **On Error GoTo 0** statement resets the properties of the **Err** object, having the same effect as the **Clear** method of the **Err** object. +The **On Error GoTo 0** statement disables error handling within a procedure. It doesn't specify line 0 as the start of the error-handling code, even if the procedure contains a line numbered 0. If there's no **On Error GoTo 0** statement in your code, the error handler is automatically disabled when the procedure has run completely. The **On Error GoTo 0** statement resets the properties of the **Err** object, having the same effect as the **Clear** method of the **Err** object. -The **On Error Resume Next** statement ignores the line that causes an error and routes execution to the line following the line that caused the error. Execution isn't interrupted. You can use the **On Error Resume Next** statement if you want to check the properties of the **Err** object immediately after a line at which you anticipate an error will occur, and handle the error within the procedure rather than in an error handler. +The **On Error Resume Next** statement ignores the line that causes an error and routes execution to the line following the line that caused the error. Execution isn't interrupted. You can use the **On Error Resume Next** statement if you want to check the properties of the **Err** object immediately after a line at which you anticipate an error will occur, and handle the error within the procedure rather than in an error handler. - _The Resume Statement_ +### Resume statement -The **Resume** statement directs execution back to the body of the procedure from within an error-handling routine. You can include a **Resume** statement within an error-handling routine if you want execution to continue at a particular point in a procedure. However, a **Resume** statement isn't necessary; you can also end the procedure after the error-handling routine. +The **Resume** statement directs execution back to the body of the procedure from within an error-handling routine. You can include a **Resume** statement within an error-handling routine if you want execution to continue at a particular point in a procedure. However, a **Resume** statement isn't necessary; you can also end the procedure after the error-handling routine. -There are three forms of the **Resume** statement. The **Resume** or **Resume 0** statement returns execution to the line at which the error occurred. The **Resume Next** statement returns execution to the line immediately following the line at which the error occurred. The **Resume** _label_ statement returns execution to the line specified by the _label_ argument. The _label_ argument must indicate either a line label or a line number. +There are three forms of the **Resume** statement. The **Resume** or **Resume 0** statement returns execution to the line at which the error occurred. The **Resume Next** statement returns execution to the line immediately following the line at which the error occurred. The **Resume** _label_ statement returns execution to the line specified by the _label_ argument. The _label_ argument must indicate either a line label or a line number. -You typically use the **Resume** or **Resume 0** statement when the user must make a correction. For example, if you prompt the user for the name of a table to open, and the user enters the name of a table that doesn't exist, you can prompt the user again and resume execution with the statement that caused the error. +You typically use the **Resume** or **Resume 0** statement when the user must make a correction. For example, if you prompt the user for the name of a table to open, and the user enters the name of a table that doesn't exist, you can prompt the user again and resume execution with the statement that caused the error. -You use the **Resume Next** statement when your code corrects for the error within an error handler, and you want to continue execution without rerunning the line that caused the error. You use the **Resume** _label_ statement when you want to continue execution at another point in the procedure, specified by the _label_ argument. For example, you might want to resume execution at an exit routine, as described in the following section. +You use the **Resume Next** statement when your code corrects for the error within an error handler, and you want to continue execution without rerunning the line that caused the error. You use the **Resume** _label_ statement when you want to continue execution at another point in the procedure, specified by the _label_ argument. For example, you might want to resume execution at an exit routine, as described in the following section. - _Exiting a Procedure_ +### Exiting a procedure When you include an error-handling routine in a procedure, you should also include an exit routine, so that the error-handling routine will run only if an error occurs. You can specify an exit routine with a line label in the same way that you specify an error-handling routine. -For example, you can add an exit routine to the example in the previous section. If an error doesn't occur, the exit routine runs after the body of the procedure. If an error occurs, then execution passes to the exit routine after the code in the error-handling routine has run. The exit routine contains an **Exit** statement. - - - +For example, you can add an exit routine to the example in the previous section. If an error doesn't occur, the exit routine runs after the body of the procedure. If an error occurs, then execution passes to the exit routine after the code in the error-handling routine has run. The exit routine contains an **Exit** statement. ```vb Function MayCauseAnError() @@ -95,11 +90,11 @@ Error_MayCauseAnError: End Function ``` - _Handling Errors in Nested Procedures_ +### Handling errors in nested procedures When an error occurs in a nested procedure that doesn't have an enabled error handler, Visual Basic searches backward through the calls list for an enabled error handler in another procedure, rather than simply halting execution. This provides your code with an opportunity to correct the error within another procedure. For example, suppose Procedure A calls Procedure B, and Procedure B calls Procedure C. If an error occurs in Procedure C and there's no enabled error handler, Visual Basic checks Procedure B, then Procedure A, for an enabled error handler. If one exists, execution passes to that error handler. If not, execution halts and an error message is displayed. -Visual Basic also searches backward through the calls list for an enabled error handler when an error occurs within an active error handler. You can force Visual Basic to search backward through the calls list by raising an error within an active error handler with the **Raise** method of the **Err** object. This is useful for handling errors that you don't anticipate within an error handler. If an unanticipated error occurs, and you regenerate that error within the error handler, then execution passes back up the calls list to find another error handler, which may be set up to handle the error. +Visual Basic also searches backward through the calls list for an enabled error handler when an error occurs within an active error handler. You can force Visual Basic to search backward through the calls list by raising an error within an active error handler with the **Raise** method of the **Err** object. This is useful for handling errors that you don't anticipate within an error handler. If an unanticipated error occurs, and you regenerate that error within the error handler, then execution passes back up the calls list to find another error handler, which may be set up to handle the error. For example, suppose Procedure C has an enabled error handler, but the error handler doesn't correct for the error that has occurred. Once the error handler has checked for all the errors that you've anticipated, it can regenerate the original error. Execution then passes back up the calls list to the error handler in Procedure B, if one exists, providing an opportunity for this error handler to correct the error. If no error handler exists in Procedure B, or if it fails to correct for the error and regenerates it again, then execution passes to the error handler in Procedure A, assuming one exists. @@ -107,39 +102,34 @@ To illustrate this concept in another way, suppose that you have a nested proced In summary, Visual Basic searches back up the calls list for an enabled error handler if: - - An error occurs in a procedure that doesn't include an enabled error handler. -- An error occurs within an active error handler. If you use the **Raise** method of the **Err** object to raise an error, you can force Visual Basic to search backward through the calls list for an enabled error handler. +- An error occurs within an active error handler. If you use the **Raise** method of the **Err** object to raise an error, you can force Visual Basic to search backward through the calls list for an enabled error handler. -## Getting Information About an Error +## Getting information about an error -Once execution has passed to the error-handling routine, your code must determine which error has occurred and address it. Visual Basic and Access provide several language elements that you can use to get information about a specific error. Each is suited to different types of errors. Since errors can occur in different parts of your application, you need to determine which to use in your code based on what errors you expect. +After execution has passed to the error-handling routine, your code must determine which error has occurred and address it. Visual Basic and Access provide several language elements that you can use to get information about a specific error. Each is suited to different types of errors. Since errors can occur in different parts of your application, you need to determine which to use in your code based on what errors you expect. The language elements available for error handling include: - -- The **Err** object. +- **Err** object -- The ADO **Error** object and **Errors** collection +- ADO **Error** object and **Errors** collection -- The DAO **Error** object and **Errors** collection. +- DAO **Error** object and **Errors** collection -- The **AccessError** method. +- **AccessError** method -- The **Error** event. +- **Error** event - _The Err Object_ - -The **Err** object is provided by Visual Basic. When a Visual Basic error occurs, information about that error is stored in the **Err** object. The **Err** object maintains information about only one error at a time. When a new error occurs, the **Err** object is updated to include information about that error instead. - -To get information about a particular error, you can use the properties and methods of the **Err** object. The **Number** property is the default property of the **Err** object; it returns the identifying number of the error that occurred. The **Err** object's **Description** property returns the descriptive string associated with a Visual Basic error. The **Clear** method clears the current error information from the **Err** object. The **Raise** method generates a specific error and populates the properties of the **Err** object with information about that error. - -The following example shows how to use the **Err** object in a procedure that may cause a type mismatch error: +### Err object +The **Err** object is provided by Visual Basic. When a Visual Basic error occurs, information about that error is stored in the **Err** object. The **Err** object maintains information about only one error at a time. When a new error occurs, the **Err** object is updated to include information about that error instead. +To get information about a particular error, you can use the properties and methods of the **Err** object. The **Number** property is the default property of the **Err** object; it returns the identifying number of the error that occurred. The **Err** object's **Description** property returns the descriptive string associated with a Visual Basic error. The **Clear** method clears the current error information from the **Err** object. The **Raise** method generates a specific error and populates the properties of the **Err** object with information about that error. +The following example shows how to use the **Err** object in a procedure that may cause a type mismatch error: ```vb Function MayCauseAnError() @@ -172,38 +162,41 @@ Error_MayCauseAnError: End Function ``` -Note that in the preceding example, the **Raise** method is used to regenerate the original error. If an error other than a type mismatch error occurs, execution will be passed back up the calls list to another enabled error handler, if one exists. +Note that in the preceding example, the **Raise** method is used to regenerate the original error. If an error other than a type mismatch error occurs, execution will be passed back up the calls list to another enabled error handler, if one exists. -The **Err** object provides you with all the information you need about Visual Basic errors. However, it doesn't give you complete information about Access errors or Access database engine errors. Access and Data Access Objects (DAO)) provide additional language elements to assist you with those errors. +The **Err** object provides you with all the information you need about Visual Basic errors. However, it doesn't give you complete information about Access errors or Access database engine errors. Access and Data Access Objects (DAO)) provide additional language elements to assist you with those errors. - _The Error Object and Errors Collection_ +### Error object and Errors collection -The **Error** object and **Errors** collection are provided by ADO and DAO. The **Error** object represents an ADO or DAO error. A single ADO or DAO operation may cause several errors, especially if you are performing DAO ODBC operations. Each error that occurs during a particular data access operation has an associated **Error** object. All the **Error** objects associated with a particular ADO or DAO operation are stored in the **Errors** collection, the lowest-level error being the first object in the collection and the highest-level error being the last object in the collection. +The **Error** object and **Errors** collection are provided by ADO and DAO. The **Error** object represents an ADO or DAO error. A single ADO or DAO operation may cause several errors, especially if you are performing DAO ODBC operations. Each error that occurs during a particular data access operation has an associated **Error** object. All the **Error** objects associated with a particular ADO or DAO operation are stored in the **Errors** collection, the lowest-level error being the first object in the collection and the highest-level error being the last object in the collection. -When a ADO or DAO error occurs, the Visual Basic **Err** object contains the error number for the first object in the **Errors** collection. To determine whether additional ADO or DAO errors have occurred, check the **Errors** collection. The values of the ADO **Number** or DAO **Number** properties and the ADO **Description** or DAO **Description** properties of the first **Error** object in the **Errors** collection should match the values of the **Number** and **Description** properties of the Visual Basic **Err** object. +When a ADO or DAO error occurs, the Visual Basic **Err** object contains the error number for the first object in the **Errors** collection. To determine whether additional ADO or DAO errors have occurred, check the **Errors** collection. The values of the ADO **Number** or DAO **Number** properties and the ADO **Description** or DAO **Description** properties of the first **Error** object in the **Errors** collection should match the values of the **Number** and **Description** properties of the Visual Basic **Err** object. - _The AccessError Method_ +### AccessError method -You can use the **Raise** method of the **Err** object to generate a Visual Basic error that hasn't actually occurred and determine the descriptive string associated with that error. However, you can't use the **Raise** method to generate a Access error, an ADO error, or a DAO error. To determine the descriptive string associated with an Access error, an ADO error, or a DAO error that hasn't actually occurred, use the **AccessError** method. +You can use the **Raise** method of the **Err** object to generate a Visual Basic error that hasn't actually occurred and determine the descriptive string associated with that error. However, you can't use the **Raise** method to generate a Access error, an ADO error, or a DAO error. To determine the descriptive string associated with an Access error, an ADO error, or a DAO error that hasn't actually occurred, use the **AccessError** method. - _The Error Event_ +### Error event You can use the Error event to trap errors that occur on an Access form or report. For example, if a user tries to enter text in a field whose data type is Date/Time, the Error event occurs. If you add an Error event procedure to an Employees form, then try to enter a text value in the HireDate field, the Error event procedure runs. -The Error event procedure takes an integer argument, DataErr. When an Error event procedure runs, the DataErr argument contains the number of the Access error that occurred. Checking the value of the DataErr argument within the event procedure is the only way to determine the number of the error that occurred. The **Err** object isn't populated with error information after the Error event occurs. You can use the value of the DataErr argument together with the **AccessError** method to determine the number of the error and its descriptive string. +The Error event procedure takes an integer argument, DataErr. When an Error event procedure runs, the DataErr argument contains the number of the Access error that occurred. Checking the value of the DataErr argument within the event procedure is the only way to determine the number of the error that occurred. The **Err** object isn't populated with error information after the Error event occurs. You can use the value of the DataErr argument together with the **AccessError** method to determine the number of the error and its descriptive string. +> [!NOTE] +> The **Error** statement and **Error** function are provided for backward compatibility only. When writing new code, use the **Err** and **Error** objects, the **AccessError** function, and the Error event for getting information about an error. - **Note** The **Error** statement and **Error** function are provided for backward compatibility only. When writing new code, use the **Err** and **Error** objects, the **AccessError** function, and the Error event for getting information about an error. - - **Link provided by:** The[UtterAccess](https://www.utteraccess.com) community +### About the contributors +**Link provided by** ![Community Member Icon](../../../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) the [UtterAccess](https://www.utteraccess.com) community. - [Handling Access Errors with VBA](https://www.utteraccess.com/wiki/index.php/Error_Handling) - - -## About the Contributors - -UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join. +UtterAccess is the premier Microsoft Access wiki and help forum. +## See also +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) diff --git a/access/Concepts/Error-Codes/error-trapping.md b/access/Concepts/Error-Codes/error-trapping.md index eb9a3914e38..25d6b17b7d6 100644 --- a/access/Concepts/Error-Codes/error-trapping.md +++ b/access/Concepts/Error-Codes/error-trapping.md @@ -1,28 +1,23 @@ --- -title: Error Trapping +title: Error trapping keywords: vbaac10.chm5186626 f1_keywords: - vbaac10.chm5186626 ms.prod: access ms.assetid: 41d8de92-55ed-8537-eb31-6d72ba69c165 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Error Trapping - -You can use the **On Error GoTo** statement to trap errors and direct procedure flow to the location of error-handling statements within a procedure. For example, the following statement directs the flow to the label line: +# Error trapping +You can use the **On Error GoTo** statement to trap errors and direct procedure flow to the location of error-handling statements within a procedure. For example, the following statement directs the flow to the label line: ```vb On Error GoTo ErrorHandler ``` - -Be sure to give each error handler label in a procedure a unique name that will not conflict with any other element in the procedure, and make sure you append a colon to the name. Within the procedure, place the **Exit Sub** or **Exit Function** statement in front of the error handler label so that the procedure doesn't run the error-checking code if no error occurs. - - - +Be sure to give each error handler label in a procedure a unique name that will not conflict with any other element in the procedure, and make sure you append a colon to the name. Within the procedure, place the **Exit Sub** or **Exit Function** statement in front of the error handler label so that the procedure doesn't run the error-checking code if no error occurs. ```vb Sub CausesAnError() @@ -40,13 +35,12 @@ ErrorHandler: End Sub ``` -The **Raise** method of the **Err** object generates the specified error. The **Number** property of the **Err** object returns the number corresponding to the most recent run-time error; the **Description** property returns the corresponding message text for a given error. - - **Note** - -* In versions 1.x and 2.0 of Access, you might have used the Error statement to generate the error, the Err function to return the error number, and the Error function to return a description of the error. Existing error-handling code that relies on the Error statement and the Error function will continue to work. However, it's better to use the Err object and its properties and methods when writing new code. - -* Versions 1.x and 2.0 of Access returned only one error for all Automation, (formerly called OLE Automation) errors. The COM component application that generated the error now returns the same error information that you would receive if you were working in that application. You may need to rewrite existing error-handling code to handle new Automation errors properly. +The **Raise** method of the **Err** object generates the specified error. The **Number** property of the **Err** object returns the number corresponding to the most recent run-time error; the **Description** property returns the corresponding message text for a given error. -* If you wish to return the descriptive string associated with a Access error or a Data Access Objects (DAO) error, but the error has not actually occurred in your code, you can use the AccessError method to return the string. +> [!NOTE] +> - In versions 1.x and 2.0 of Access, you might have used the Error statement to generate the error, the Err function to return the error number, and the Error function to return a description of the error. Existing error-handling code that relies on the Error statement and the Error function will continue to work. However, it's better to use the Err object and its properties and methods when writing new code. +> +> - Versions 1.x and 2.0 of Access returned only one error for all Automation, (formerly called OLE Automation) errors. The COM component application that generated the error now returns the same error information that you would receive if you were working in that application. You may need to rewrite existing error-handling code to handle new Automation errors properly. +> +> - If you wish to return the descriptive string associated with a Access error or a Data Access Objects (DAO) error, but the error has not actually occurred in your code, you can use the AccessError method to return the string. diff --git a/access/Concepts/Error-Codes/improvements-in-compilation-performance.md b/access/Concepts/Error-Codes/improvements-in-compilation-performance.md index d6f1459ee24..813e87506f3 100644 --- a/access/Concepts/Error-Codes/improvements-in-compilation-performance.md +++ b/access/Concepts/Error-Codes/improvements-in-compilation-performance.md @@ -1,29 +1,29 @@ --- -title: Improvements in Compilation Performance +title: Improvements in compilation performance keywords: vbaac10.chm5187335 f1_keywords: - vbaac10.chm5187335 ms.prod: access ms.assetid: 122a8429-ad31-4e4b-2f68-d9d07c1deeeb -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Improvements in Compilation Performance +# Improvements in compilation performance Access includes improvements to module loading and compilation performance to make your code compile and run faster. -## Form and Report Modules Created on Demand +## Form and report modules created on demand -When you create a form or report in Access 2002 or later, the form or report doesn't automatically have an associated module. When you click **Code** on the toolbar to view the form's or report's module, the module is created. You can also create the module from Visual Basic by referring to the form's **[Module](../../../api/Access.Form.Module.md)** property while the form or report is in Design view, or by setting the **[HasModule](../../../api/Access.Form.HasModule.md)** property to **True**. +When you create a form or report in Access 2002 or later, the form or report doesn't automatically have an associated module. When you click **Code** on the toolbar to view the form's or report's module, the module is created. You can also create the module from Visual Basic by referring to the form's **[Module](../../../api/Access.Form.Module.md)** property while the form or report is in Design view, or by setting the **[HasModule](../../../api/Access.Form.HasModule.md)** property to **True**. -The setting of the **HasModule** property indicates whether a form or report currently has an associated module. +The setting of the **HasModule** property indicates whether a form or report currently has an associated module. Since a form or report module isn't created until you need to add code to it, your project may have fewer modules to compile, resulting in improved compilation performance. Also, forms and reports without modules load more quickly than those with modules. -## Compiling on Demand +## Compiling on demand It's a good idea to explicitly compile the modules in your project by using the commands described above, but it's not necessary. Access compiles a module before running a procedure in it if the module hasn't already been compiled. diff --git a/access/Concepts/Error-Codes/macro-actions-and-methods-of-the-docmd-object.md b/access/Concepts/Error-Codes/macro-actions-and-methods-of-the-docmd-object.md index 75cfeee43ea..232806a1cf2 100644 --- a/access/Concepts/Error-Codes/macro-actions-and-methods-of-the-docmd-object.md +++ b/access/Concepts/Error-Codes/macro-actions-and-methods-of-the-docmd-object.md @@ -1,26 +1,26 @@ --- -title: Macro Actions and Methods of the DoCmd Object +title: Macro actions and methods of the DoCmd object keywords: vbaac10.chm5187441 f1_keywords: - vbaac10.chm5187441 ms.prod: access ms.assetid: aab25fbe-8ec3-5c45-dd70-a0e8c885406a -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Macro Actions and Methods of the DoCmd Object +# Macro actions and methods of the DoCmd object -To carry out macro actions from code in Access, use the [DoCmd](../../../api/Access.DoCmd.md)object and its methods. This object replaces the **DoCmd** statement that you used in versions 1. _x_ and 2.0 of Access to carry out a macro action. +To carry out macro actions from code in Access, use the [DoCmd](../../../api/Access.DoCmd.md)object and its methods. This object replaces the **DoCmd** statement that you used in versions 1. _x_ and 2.0 of Access to carry out a macro action. -When you convert a database, Access automatically converts any **DoCmd** statements and the actions that they carried out in your Access Basic code to methods of the **DoCmd** object by replacing the space with the . (dot) operator. +When you convert a database, Access automatically converts any **DoCmd** statements and the actions that they carried out in your Access Basic code to methods of the **DoCmd** object by replacing the space with the . (dot) operator. Some macro actions work differently in Access 9.0 and later than in version 1. _x_, 2.0, or 7.0; these differences are detailed below. -## Databases Created with Access 95 +## Databases created with Access 95 - _The DoMenuItem Action_ +### DoMenuItem action The DoMenuItem action is no longer used in Access. The RunCommand action can be used to accomplish the tasks for which you used to use the DoMenuItem action. @@ -29,20 +29,20 @@ When you enable a database created with a prior version of Access, the DoMenuIte When you convert a database created with a prior version of Access, all DoMenuItem actions in macros are replaced with RunCommand actions the first time that the macros are saved after conversion. DoMenuItem methods used in Visual Basic procedures aren't changed. -## Databases Created with Access Version 1. +## Databases created with Access version 1 - _The TransferSpreadsheet Action_ +### TransferSpreadsheet action Access can't import Excel version 2.0 spreadsheets or Lotus 1-2-3 version 1.0 spreadsheets. If your converted database contains a macro that provided this functionality by using the TransferSpreadsheet action in Access version 1. _x_ or 2.0, converting the database will change the Spreadsheet Type argument to Excel version 3.0 (if you originally specified Excel version 2.0), or causes an error if you originally specified Lotus 1-2-3 version 1.0 format. To work around this problem, convert the spreadsheets to a later version of Excel or Lotus 1-2-3 before importing them into Access. - _The TransferText and TransferSpreadsheet Actions_ +### TransferText and TransferSpreadsheet actions In Access, you can't use a SQL statement to specify data to export when you're using the TransferText action or the TransferSpreadsheet action. Instead of using a SQL statement, you must first create a query and then specify the name of the query in the Table Name argument. - _Comparisons Involving Null Values_ +### Comparisons involving Null values -In Access versions 1.x and 2.0, if you compare two expressions within a macro condition by using a comparison operator and one of the expressions is **Null**, Access Basic will return **True** or **False** for the comparison, depending on which comparison operator you use. In Access 2000 and later, Visual Basic returns **Null** for a comparison in which one expression is **Null**. To determine whether the comparison evaluates to **Null**, use the **IsNull** function to check the result of the comparison. +In Access versions 1.x and 2.0, if you compare two expressions within a macro condition by using a comparison operator and one of the expressions is **Null**, Access Basic will return **True** or **False** for the comparison, depending on which comparison operator you use. In Access 2000 and later, Visual Basic returns **Null** for a comparison in which one expression is **Null**. To determine whether the comparison evaluates to **Null**, use the **IsNull** function to check the result of the comparison. diff --git a/access/Concepts/Error-Codes/program-with-class-modules.md b/access/Concepts/Error-Codes/program-with-class-modules.md index 18cd34fa32e..491426d5376 100644 --- a/access/Concepts/Error-Codes/program-with-class-modules.md +++ b/access/Concepts/Error-Codes/program-with-class-modules.md @@ -1,27 +1,23 @@ --- -title: Program with Class Modules +title: Program with class modules keywords: vbaac10.chm5187902 f1_keywords: - vbaac10.chm5187902 ms.prod: access ms.assetid: 6b10be38-bfe6-dea2-4aa5-4859722c1869 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Program with Class Modules +# Program with class modules -In Access, there were two types of modules: standard modules and class modules. In Access 95, class modules existed only in association with a form or report. In Access 97, they also existed on the **Modules** tab of the Database window. - - -## Creating Custom Objects with Class Modules - -You can use a class module to create a definition for a custom object. The name with which you save the class module becomes the name of your custom object. Public **Sub** and **Function** procedures that you define within a class module become custom methods of the object. Public **Property Let**, **Property Get**, and **Property Set** procedures become properties of the object. - -Once you've defined procedures within the class module, you can create the new object by creating a new instance of the class. To create a new instance of a class, you declare a variable of the type defined by that class. For example, if the name of your class is ABasicClass, you would create a new instance of it in the following manner: +In Access, there were two types of modules: standard modules and class modules. In Access 95, class modules existed only in association with a form or report. In Access 97, they also existed on the **Modules** tab of the Database window. +## Create custom objects with class modules +You can use a class module to create a definition for a custom object. The name with which you save the class module becomes the name of your custom object. Public **Sub** and **Function** procedures that you define within a class module become custom methods of the object. Public **Property Let**, **Property Get**, and **Property Set** procedures become properties of the object. +After you've defined procedures within the class module, you can create the new object by creating a new instance of the class. To create a new instance of a class, you declare a variable of the type defined by that class. For example, if the name of your class is ABasicClass, you would create a new instance of it in the following manner: ```vb Dim abc As New ABasicClass @@ -29,24 +25,18 @@ Dim abc As New ABasicClass When you run the code containing this declaration, Visual Basic creates the new instance. You can then apply its methods and properties by using the variable . For example, if you've defined a custom method called ListNames, you could apply it as follows: - - - ```vb abc.ListNames ``` -## New in Access 95: Creating the Default Instance of a Form Class +## Create the default instance of a form class (Access 95) When you open a form in Form view, whether from the user interface or from Visual Basic, you create an instance of that form's class module. In other words, you designate space in memory where the object now exists, and you can then call its methods and set or return its properties from code, as you would for any built-in object. The same is true when you open a report in Print Preview. When you refer to a form in Visual Basic code, you're usually working with the default instance of the form's class. A form's class has only one default instance. You can also create multiple instances of the same form's class from Visual Basic. When you create multiple instances of a form's class, you create nondefault instances. -There are four ways to create the default instance of a form. You can open an existing form by using the user interface, by executing the **[OpenForm](../../../api/Access.DoCmd.OpenForm.md)** method of the **[DoCmd](../../../api/Access.DoCmd.md)** object, by calling the **[CreateForm](../../../api/Access.Application.CreateForm.md)** method and switching the new form into Form view, or by using Visual Basic to create a variable of type **Form** to refer to the default instance. The following example opens an Employees form and points a **Form** object variable to it: - - - +There are four ways to create the default instance of a form. You can open an existing form by using the user interface, by executing the **[OpenForm](../../../api/Access.DoCmd.OpenForm.md)** method of the **[DoCmd](../../../api/Access.DoCmd.md)** object, by calling the **[CreateForm](../../../api/Access.Application.CreateForm.md)** method and switching the new form into Form view, or by using Visual Basic to create a variable of type **Form** to refer to the default instance. The following example opens an Employees form and points a **Form** object variable to it: ```vb Dim frm As Form @@ -56,40 +46,34 @@ Set frm = Forms!Employees Access also provides a shortcut that enables you to open a form and refer to a method or property of that form or one of its controls in one step. You refer to the form's class module as shown in the following example: - - - ```vb Form_Employees.Visible = True Form_Employees.Caption = "New Employees" ``` -When you run this code, Access opens the Employees form in Form view if it's not already open and sets the form's caption to "New Employees." The form isn't visible until you explicitly set its **[Visible](../../../api/Access.Form.Visible.md)** property to **True**. When the procedure that calls this code has finished executing, this instance of the form is destroyed; that is, the form is closed. +When you run this code, Access opens the Employees form in Form view if it's not already open and sets the form's caption to "New Employees." The form isn't visible until you explicitly set its **[Visible](../../../api/Access.Form.Visible.md)** property to **True**. When the procedure that calls this code has finished executing, this instance of the form is destroyed; that is, the form is closed. If you try to run this code when the Employees form is open in Design view, Access generates a run-time error. The form must either be open in Form view or not open at all. If you use this syntax to change a property of the form or one of its controls, that change is lost when the instance of the form is destroyed. This holds true any time you change a property setting for a form in Form view. You must change the property in Design view and save the change with the form. -## Creating Multiple Nondefault Instances of Forms +## Create multiple nondefault instances of forms You can create multiple nondefault instances of a form's class if you want to display more than one instance of a form at a time. For example, you might want to display the records for an employee and the employee's manager at the same time. You can create one instance of the Employees form's class to display the employee's record, and one to display the manager's record. -To create new, nondefault instances of a form's class from Visual Basic, declare a variable for which the type is the name of the form class module. You must include the **New** keyword in the variable declaration. For example, the following code creates a new instance of the Employees form and assigns it to a variable of type **Form**: - - - +To create new, nondefault instances of a form's class from Visual Basic, declare a variable for which the type is the name of the form class module. You must include the **New** keyword in the variable declaration. For example, the following code creates a new instance of the Employees form and assigns it to a variable of type **Form**: ```vb Dim frm As New Form_Employees ``` -This nondefault instance of the form isn't visible until you explicitly set its **Visible** property. +This nondefault instance of the form isn't visible until you explicitly set its **Visible** property. -When the procedure that creates this instance has finished executing, the instance is removed from memory unless you've declared the variable representing it as a module-level variable. Since module-level variables retain their values until they are reset with the **Reset** command on the **Run** menu or the **Reset** button on the toolbar, the form will stay open if the variable has been declared as a module-level variable. +When the procedure that creates this instance has finished executing, the instance is removed from memory unless you've declared the variable representing it as a module-level variable. Since module-level variables retain their values until they are reset with the **Reset** command on the **Run** menu or the **Reset** button on the toolbar, the form will stay open if the variable has been declared as a module-level variable. Any properties that you set will affect this instance of the form's class, but won't be saved with the form. Also, a new instance of the form's class can't be created if the form is open in Design view. -A nondefault instance of a form's class can't be referred to by name in the **[Forms](../../../api/Access.Forms.md)** collection. You can refer to it by index number only. Since you can create multiple nondefault instances of a form, and each instance has the same name, you can have more than one form with the same name in the **Forms** collection, without any means of distinguishing them other than by index number. +A nondefault instance of a form's class can't be referred to by name in the **[Forms](../../../api/Access.Forms.md)** collection. You can refer to it by index number only. Since you can create multiple nondefault instances of a form, and each instance has the same name, you can have more than one form with the same name in the **Forms** collection, without any means of distinguishing them other than by index number. diff --git a/access/Concepts/Error-Codes/scoping-and-object-naming-compatibility.md b/access/Concepts/Error-Codes/scoping-and-object-naming-compatibility.md index 5b6b1a684a5..244c463e59f 100644 --- a/access/Concepts/Error-Codes/scoping-and-object-naming-compatibility.md +++ b/access/Concepts/Error-Codes/scoping-and-object-naming-compatibility.md @@ -1,27 +1,27 @@ --- -title: Scoping and Object-Naming Compatibility +title: Scoping and object-naming compatibility keywords: vbaac10.chm5188026 f1_keywords: - vbaac10.chm5188026 ms.prod: access ms.assetid: 50e86279-78d0-c509-1598-250517153fe7 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Scoping and Object-Naming Compatibility +# Scoping and object-naming compatibility -Visual Basic scoping rules affect the names you choose for your objects, modules, and procedures. +Visual Basic scoping rules affect the names that you choose for your objects, modules, and procedures. -## Modules and Other Objects with the Same Name +## Modules and other objects with the same name When you name a module, avoid prefacing module names with "Form_" or "Report_". Naming a module in this way could conflict with existing code you've written behind forms and reports. If you have a module in an application created with version 1. _x_ or 2.0 of Access that doesn't follow these naming rules, Access generates an error when you try to convert your application. For example, a module named Form_Orders in an Access version 1. _x_ or 2.0 database would generate an error and you would be asked to rename the module before attempting to convert it. -## Modules and Procedures with the Same Name +## Modules and procedures with the same name Although it is not suggested, you can have a procedure with the same name as a module. To call that procedure from an expression anywhere in your application, you must use a fully qualified name for the procedure, including both the module name and the procedure name, as in the following example: @@ -31,31 +31,28 @@ IsLoaded.IsLoaded("Orders") ``` - **Note** This will not work with the **Runcode** action in macros. Accessing procedures with the same name as a module is not possible with macros. +> [!NOTE] +> This will not work with the **Runcode** action in macros. Accessing procedures with the same name as a module is not possible with macros. -## Procedures and Controls with the Same Name +## Procedures and controls with the same name If you call a procedure from a form, and that procedure has the same name as a control on the form, you must fully qualify the procedure call with the name of the module in which it resides. For example, if you want to call a procedure named PrintInvoice that resides in a standard module named Utilities, and there's also a button on the same form named PrintInvoice, use the fully qualified name when you call the procedure from your form or form module. -## Controls with Similar Names +## Controls with similar names You can't have a control with a name that differs from an existing control's name by only a space or a symbol. For example, if you have a control named [Last_Name], you can't have a control named [Last Name] or [Last+Name]. -## Modules with the Same Names as Type Libraries +## Modules with the same names as type libraries You can't save a module with the same name as a type library. If you try to save a module with the name "ADO", "Access", "DAO" or "VBA", you'll get an error stating that the name conflicts with an existing module, project, or object library. Similarly, if you've set a reference to another type library, such as the Excel type library, you can't save a module with the name "Excel". -## Fields with the Same Names as Methods - -If a field in the table has the same name as an ActiveX Data Objects (ADO) method on an ADO **Recordset** object, or a Data Access Object (DAO) method on a DAO **Recordset** object, you can't refer to the corresponding field in the recordset with the . (dot) syntax. You must use the ! (exclamation point) syntax, or Access will generate an error. The following example shows how to refer to a field called AddNew in a recordset opened on a table called Contacts: - - - +## Fields with the same names as methods +If a field in the table has the same name as an ActiveX Data Objects (ADO) method on an ADO **Recordset** object, or a Data Access Object (DAO) method on a DAO **Recordset** object, you can't refer to the corresponding field in the recordset with the . (dot) syntax. You must use the ! (exclamation point) syntax, or Access will generate an error. The following example shows how to refer to a field called AddNew in a recordset opened on a table called Contacts: ```vb Dim rst As New ADODB.Recordset @@ -66,9 +63,6 @@ Debug.Print rst!AddNew ``` - - - ```vb Dim dbs As Database, rst As DAO.Recordset Set dbs = CurrentDb @@ -77,30 +71,30 @@ Debug.Print rst!AddNew ``` -## Modules with the Same Names as Visual Basic Functions +## Modules with the same names as Visual Basic functions -If you save a module with the same name as an intrinsic Visual Basic function, Access will generate an error when you try to run that function. For example, if you save a module named MsgBox, and then try to run a procedure that calls the **MsgBox** function, Access generates the error "Expected variable or procedure, not module." +If you save a module with the same name as an intrinsic Visual Basic function, Access will generate an error when you try to run that function. For example, if you save a module named MsgBox, and then try to run a procedure that calls the **MsgBox** function, Access generates the error "Expected variable or procedure, not module." -## Modules with the Same Names as Objects +## Modules with the same names as objects If a database created with a previous version of Access includes a module that has the same name as an Access object, an ADO object, or a DAO object, you may encounter compilation errors when you convert your database. For example, a module named "Form" or "Database" may generate a compilation error. To avoid these errors, rename the module. -## Naming Fields Used in Expressions or Bound to Controls on Forms and Reports +## Naming fields used in expressions or bound to controls on forms and reports -When you create a field in a table that will be bound to a control on a report or used in an expression in the **ControlSource** property of a control or a report, avoid assigning the field a name that's the same name as a method of the **[Application](../../../api/Access.Application.md)** object. To see a list of methods of the **Application** object, click **Object Browser** on the **View** menu while in module Design view. Click **Access** in the **Project/Library** box, click **Application** in the **Classes** box, and view the methods of the **Application** object in the **Members Of** box. +When you create a field in a table that will be bound to a control on a report or used in an expression in the **ControlSource** property of a control or a report, avoid assigning the field a name that's the same name as a method of the **[Application](../../../api/Access.Application.md)** object. To see a list of methods of the **Application** object, click **Object Browser** on the **View** menu while in module Design view. Click **Access** in the **Project/Library** box, click **Application** in the **Classes** box, and view the methods of the **Application** object in the **Members Of** box. When you create a field in a table that will be bound to a control on a form or report, avoid assigning the field any of the following names: AddRef, GetIDsOfNames, GetTypeInfo, GetTypeInfoCount, Invoke, QueryInterface, or Release. -## Identifiers with Same Names as Visual Basic Keywords +## Identifiers with the same names as Visual Basic keywords -The version of Visual Basic that's used by Access 97 (and later) contains some new Visual Basic keywords, so you can no longer use these keywords as identifiers. These keywords are: **AddressOf**, **Assert**, **Decimal**, **DefDec**, **Enum**, **Event**, **Friend**, **Implements**, **RaiseEvent**, and **WithEvents**. When you convert a database developed with a prior version of Access, existing identifiers that are the same as a new Visual Basic keyword will cause a compile error. To correct this problem, rename the identifiers. +The version of Visual Basic that's used by Access 97 (and later) contains some new Visual Basic keywords, so you can no longer use these keywords as identifiers. These keywords are: **AddressOf**, **Assert**, **Decimal**, **DefDec**, **Enum**, **Event**, **Friend**, **Implements**, **RaiseEvent**, and **WithEvents**. When you convert a database developed with a prior version of Access, existing identifiers that are the same as a new Visual Basic keyword will cause a compile error. To correct this problem, rename the identifiers. -## Project Names the Same as Access Objects +## Project names that are the same as Access objects -A project name is the string that is the name of your Access application. In prior versions of Access, the project name was the name of the database. Beginning in Access 2000, the project name is specified by the **ProjectName** property setting and its default setting is the name of the database. If you convert a database with a name that is the same as a class of objects, for example, "application," "form," or "report," Access will append an underscore character to the database name to create a project name that does not conflict with existing objects. +A project name is the string that is the name of your Access application. In prior versions of Access, the project name was the name of the database. Beginning in Access 2000, the project name is specified by the **ProjectName** property setting, and its default setting is the name of the database. If you convert a database with a name that is the same as a class of objects, for example, "application," "form," or "report," Access will append an underscore character to the database name to create a project name that does not conflict with existing objects. diff --git a/access/Concepts/Error-Codes/using-enumerated-constants-in-microsoft-access-2002-and-later.md b/access/Concepts/Error-Codes/using-enumerated-constants-in-microsoft-access-2002-and-later.md index 38c91502d5d..5b90def0307 100644 --- a/access/Concepts/Error-Codes/using-enumerated-constants-in-microsoft-access-2002-and-later.md +++ b/access/Concepts/Error-Codes/using-enumerated-constants-in-microsoft-access-2002-and-later.md @@ -1,25 +1,29 @@ --- -title: Using Enumerated Constants in Microsoft Access 2002 and Later +title: Using enumerated constants in Microsoft Access 2002 and later keywords: vbaac10.chm113266 f1_keywords: - vbaac10.chm113266 ms.prod: access ms.assetid: 7eb8fb08-76e5-a59f-5d6d-64c7081470e6 -ms.date: 06/08/2017 +ms.date: 09/21/2018 --- -# Using Enumerated Constants in Microsoft Access 2002 and Later +# Using enumerated constants in Microsoft Access 2002 and later -In Access 2002, a number of intrinsic constants were added or changed. This was done to create lists of "enumerated" constants that are displayed in the **Auto List Members** list in the Module window for the arguments of various Access methods, functions, and properties, or as the setting of various Access properties. You can select the appropriate constant from the list in the Module window, instead of having to remember the constant or look it up in the Help topic. +In Access 2002, a number of intrinsic constants were added or changed. This was done to create lists of "enumerated" constants that are displayed in the **Auto List Members** list in the Module window for the arguments of various Access methods, functions, and properties, or as the setting of various Access properties. You can select the appropriate constant from the list in the Module window, instead of having to remember the constant or look it up in the Help topic. The following information applies to enumerated constants: -- The set of enumerated constants for each method, function, or property argument has a name, which is displayed in the syntax line for the method, function, or property in the Module window when the **Auto Quick Info** option is selected in the **Editor** tab of the **Options** dialog box, available by clicking **Options** on the **Tools** menu. (For property settings, the name isn't displayed, just the list of constants.) For example, the syntax line for the **[OpenForm](../../../api/Access.DoCmd.OpenForm.md)** method of the **[DoCmd](../../../api/Access.DoCmd.md)** object shows **[View As AcFormView = acNormal]** for the _view_ argument of this method. **AcFormView** is the name of this set of enumerated constants, and **acNormal** is the default setting for the argument. The Object Browser also lists the names of the sets of enumerated constants in the **Classes** box and lists the intrinsic constants contained in each of these sets in the **Members Of** box. +- The set of enumerated constants for each method, function, or property argument has a name, which is displayed in the syntax line for the method, function, or property in the Module window when the **Auto Quick Info** option is selected in the **Editor** tab of the **Options** dialog box, available by selecting **Options** on the **Tools** menu. (For property settings, the name isn't displayed, just the list of constants.) + + For example, the syntax line for the **[OpenForm](../../../api/Access.DoCmd.OpenForm.md)** method of the **[DoCmd](../../../api/Access.DoCmd.md)** object shows **[View As AcFormView = acNormal]** for the _view_ argument of this method. **AcFormView** is the name of this set of enumerated constants, and **acNormal** is the default setting for the argument. The Object Browser also lists the names of the sets of enumerated constants in the **Classes** box, and lists the intrinsic constants contained in each of these sets in the **Members Of** box. - For constant names that have changed, the old constants will still work. For example, one of the intrinsic constants for the _save_ argument of the **Close** method of the **DoCmd** object was **acPrompt**. It's now **acSavePrompt**, but **acPrompt** will still work. -- In a number of cases in previous versions of Access, you could leave an argument setting blank, and Access would perform the default action for that argument. For example, you could leave the _objecttype_ (and _objectname_ ) arguments of the **Close** method blank, and Access would close the active window. For the new sets of enumerated constants, the blank setting has been replaced with a new default constant. For example, the _objecttype_ argument of the **Close** method now has a new default constant, **acDefault**. Setting this argument to the new constant has the same effect as leaving the argument blank. In addition, you can still leave such arguments blank, and Access will assume the new default constant. +- In a number of cases in previous versions of Access, you could leave an argument setting blank, and Access would perform the default action for that argument. For example, you could leave the _objecttype_ (and _objectname_ ) arguments of the **Close** method blank, and Access would close the active window. + + For the new sets of enumerated constants, the blank setting has been replaced with a new default constant. For example, the _objecttype_ argument of the **Close** method now has a new default constant, **acDefault**. Setting this argument to the new constant has the same effect as leaving the argument blank. In addition, you can still leave such arguments blank, and Access will assume the new default constant. - There's one exception to this. If you run Visual Basic code from previous versions of Visual Basic in Access by using Automation, blank arguments will cause an error for those arguments that have the new default constants. This problem doesn't occur for old Visual Basic for Applications or Visual Basic code run directly in Access. diff --git a/access/Concepts/Structured-Query-Language/order-by-clause-microsoft-access-sql.md b/access/Concepts/Structured-Query-Language/order-by-clause-microsoft-access-sql.md index 110a92093ab..6aff64d9f1a 100644 --- a/access/Concepts/Structured-Query-Language/order-by-clause-microsoft-access-sql.md +++ b/access/Concepts/Structured-Query-Language/order-by-clause-microsoft-access-sql.md @@ -58,12 +58,6 @@ If you specify a field containing Memo or OLE Object data in the ORDER BY clause ORDER BY is usually the last item in an SQL statement. You can include additional fields in the ORDER BY clause. Records are sorted first by the first field listed after ORDER BY. Records that have equal values in that field are then sorted by the value in the second field listed, and so on. - -**Link provided by:** -![Community Member Icon](../../../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community |[About the contributors](#AboutContributors) - - -- [Record Order](https://www.utteraccess.com/wiki/index.php/Record_Order) ## Example @@ -97,10 +91,12 @@ Sub OrderByX() End Sub ``` - - ### About the contributors +**Link provided by** ![Community Member Icon](../../../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) the [UtterAccess](https://www.utteraccess.com) community. + +- [Record Order](https://www.utteraccess.com/wiki/index.php/Record_Order) + UtterAccess is the premier Microsoft Access wiki and help forum. ## See also diff --git a/api/Access.ComboBox.md b/api/Access.ComboBox.md index 2d1039000a6..1d86907ed9a 100644 --- a/api/Access.ComboBox.md +++ b/api/Access.ComboBox.md @@ -32,23 +32,16 @@ The setting of the **LimitToList** property determines whether you can enter va The list can be single- or multiple-column, and the columns can appear with or without headings. - **Link provided by:** Luke Chung, [FMS, Inc.](https://www.fmsinc.com/) - +**Link provided by** Luke Chung, [FMS, Inc.](https://www.fmsinc.com/). - [Tips and Techniques for Using and Validating Combo Boxes](https://www.fmsinc.com/free/NewTips/Access/ComboBox/AccessComboBox.asp) - **Links provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community - +**Links provided by** the [UtterAccess](https://www.utteraccess.com) community. -- [Combo Box](https://www.utteraccess.com/wiki/index.php/Combo_Box) - -- [Cascading Combo Boxes](https://www.utteraccess.com/wiki/index.php/Cascading_Combo_Boxes) - -- [Cascading Combo Boxes: Demo](https://www.utteraccess.com/wiki/index.php/Cascading_Combo_Boxes:_Demo) - -- [Cascading Combo Boxes - Leaving Null Values](https://www.utteraccess.com/wiki/index.php/Cascade_Combo_Leaving_Null_Values) - +- [Combo Box](https://www.utteraccess.com/wiki/index.php/Combo_Box) +- [Cascading Combo Boxes](https://www.utteraccess.com/wiki/index.php/Cascading_Combo_Boxes) +- [Cascading Combo Boxes: Demo](https://www.utteraccess.com/wiki/index.php/Cascading_Combo_Boxes:_Demo) +- [Cascading Combo Boxes - Leaving Null Values](https://www.utteraccess.com/wiki/index.php/Cascade_Combo_Leaving_Null_Values) - [Forms: Populate Controls/Text Boxes Based on Combobox Selection](https://www.utteraccess.com/wiki/index.php/Forms:_Populate_Controls/Text_Boxes_Based_on_Combobox_Selection) @@ -56,8 +49,7 @@ The list can be single- or multiple-column, and the columns can appear with or w The following example shows how to use multiple **ComboBox** controls to supply criteria for a query. - **Sample code provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community +**Sample code provided by** the [UtterAccess](https://www.utteraccess.com) community. UtterAccess members can download a database that contains this example from [here](https://www.utteraccess.com/forum/Dynamic-Query-Examples-t1405533.html). @@ -103,8 +95,7 @@ End Sub The following example shows how to set the **RowSource** property of a combo box when a form is loaded. When the form is displayed, the items stored in the **Departments** field of the **tblDepartment** combo box are displayed in the **cboDept** combo box. - **Sample code provided by:** -![MVP Contributor](../images/odc_OfficeTA_33px_MVPContrib.jpg) Bill Jelen,[MrExcel.com](https://www.mrexcel.com/) +**Sample code provided by** ![MVP Contributor](../images/odc_OfficeTA_33px_MVPContrib.jpg) Bill Jelen, [MrExcel.com](https://www.mrexcel.com/). @@ -127,8 +118,7 @@ The following example show how to create a combo box that is bound to one column The **ColumnWidths** property specifies the width of the two columns. By setting the width of the first column to **0in.**, the first column is not displayed in the combo box. - **Sample code provided by:** -![MVP Contributor](../images/odc_OfficeTA_33px_MVPContrib.jpg) Bill Jelen,[MrExcel.com](https://www.mrexcel.com/) +**Sample code provided by** ![MVP Contributor](../images/odc_OfficeTA_33px_MVPContrib.jpg) Bill Jelen, [MrExcel.com](https://www.mrexcel.com/). @@ -146,7 +136,7 @@ End Sub The following example shows how to add an item to a bound combo box. - **Sample code provided by:** The [Microsoft Access 2010 Programmer's Reference](https://www.wrox.com/WileyCDA/WroxTitle/Access-2010-Programmer-s-Reference.productCd-0470591668.html) +**Sample code provided by** The [Microsoft Access 2010 Programmer's Reference](https://www.wrox.com/WileyCDA/WroxTitle/Access-2010-Programmer-s-Reference.productCd-0470591668.html). ```vb @@ -379,11 +369,12 @@ End Sub |[Visible](Access.ComboBox.Visible.md)| |[Width](Access.ComboBox.Width.md)| + ### About the contributors Luke Chung is the founder and president of FMS, Inc., a leading provider of custom database solutions and developer tools. -UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join. +UtterAccess is the premier Microsoft Access wiki and help forum. Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com. @@ -392,10 +383,6 @@ Wrox Press is driven by the Programmer to Programmer philosophy. Wrox books are ## See also - - - - -[Access Object Model Reference](overview/Access/object-model.md)
-[ComboBox Object Members](overview/Access.md) +- [Access Object Model Reference](overview/Access/object-model.md)
+- [ComboBox Object Members](overview/Access.md) diff --git a/api/Access.DoCmd.SendObject.md b/api/Access.DoCmd.SendObject.md index be7612a7983..ce0041590d7 100644 --- a/api/Access.DoCmd.SendObject.md +++ b/api/Access.DoCmd.SendObject.md @@ -64,12 +64,12 @@ Modules can be sent only in MS-DOS Text format, so if you specify **acSendModule > [!NOTE] > You can save as a PDF or XPS file from a 2007 Microsoft Office system program only after you install an add-in. For more information, search for "Enable support for other file formats, such as PDF and XPS" on the Office Web site. -**Link provided by:** ![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) Luke Chung, [FMS, Inc.](https://www.fmsinc.com/) +**Link provided by** Luke Chung, [FMS, Inc.](https://www.fmsinc.com/). - [Features and Limits of Using the SendObject Method to Send Emails](https://www.fmsinc.com/microsoftaccess/email/sendobject.html) -**Link provided by:** ![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community +**Link provided by** the [UtterAccess](https://www.utteraccess.com) community. - [Email from Access](https://www.utteraccess.com/forum/Email-Access-t130485.html) @@ -87,7 +87,7 @@ DoCmd.SendObject acSendTable, "Employees", acFormatXLS, _ The following example shows how to create an email message with Microsoft Outlook and display it to the user. -**Sample code provided by:** The [Microsoft Access 2010 Programmer's Reference](https://www.wrox.com/WileyCDA/WroxTitle/Access-2010-Programmer-s-Reference.productCd-0470591668.html) +**Sample code provided by** the [Microsoft Access 2010 Programmer's Reference](https://www.wrox.com/WileyCDA/WroxTitle/Access-2010-Programmer-s-Reference.productCd-0470591668.html). ```vb @@ -155,11 +155,11 @@ Luke Chung is the founder and president of FMS, Inc., a leading provider of cust Wrox Press is driven by the Programmer to Programmer philosophy. Wrox books are written by programmers for programmers, and the Wrox brand means authoritative solutions to real-world programming problems. -UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join. +UtterAccess is the premier Microsoft Access wiki and help forum. ## See also -[DoCmd Object](Access.DoCmd.md) +- [DoCmd Object](Access.DoCmd.md) diff --git a/api/Access.Form.md b/api/Access.Form.md index feab6ee29f6..b8a98f20789 100644 --- a/api/Access.Form.md +++ b/api/Access.Form.md @@ -63,26 +63,17 @@ Forms!OrderForm.ctlSubForm.Form!Controls.NewData Forms!OrderForm.ctlSubForm!NewData ``` - **Links provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) Luke Chung, [FMS, Inc.](https://www.fmsinc.com/) +**Links provided by** Luke Chung, [FMS, Inc.](https://www.fmsinc.com/). - -- [Microsoft Access Form Tips and Avoiding Common Mistakes](https://www.fmsinc.com/tpapers/genaccess/formtips.html) - +- [Microsoft Access Form Tips and Avoiding Common Mistakes](https://www.fmsinc.com/tpapers/genaccess/formtips.html) - [Microsoft Office Access 2007 Form Design Tips](https://www.fmsinc.com/tpapers/access/Forms/Access2007FormTips.html) - **Links provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community +**Links provided by** the [UtterAccess](https://www.utteraccess.com) community. - -- [Display Pictures on a Form](https://www.utteraccess.com/wiki/index.php/Display_Pictures_on_a_Form) - -- [Display Related Data](https://www.utteraccess.com/wiki/index.php/Display_Related_Data) - -- [Opening a Detail Form to Related Information](https://www.utteraccess.com/wiki/index.php/Forms:_Open_a_Detail_Form_to_Related_Information) - -- [Forms: Populate Controls/Text Boxes Based on Combobox Selection](https://www.utteraccess.com/wiki/index.php/Forms:_Populate_Controls/Text_Boxes_Based_on_Combobox_Selection) - +- [Display Pictures on a Form](https://www.utteraccess.com/wiki/index.php/Display_Pictures_on_a_Form) +- [Display Related Data](https://www.utteraccess.com/wiki/index.php/Display_Related_Data) +- [Opening a Detail Form to Related Information](https://www.utteraccess.com/wiki/index.php/Forms:_Open_a_Detail_Form_to_Related_Information) +- [Forms: Populate Controls/Text Boxes Based on Combobox Selection](https://www.utteraccess.com/wiki/index.php/Forms:_Populate_Controls/Text_Boxes_Based_on_Combobox_Selection) - [Referring To Properties And Controls On Subforms](https://www.utteraccess.com/wiki/index.php/Referring_To_Properties_And_Controls_On_Subforms) @@ -92,8 +83,7 @@ The following example shows how to use **TextBox** controls to supply date crit UtterAccess members can download a database that contains this example from [here](https://www.utteraccess.com/forum/Dynamic-Query-Examples-t1405533.html). - **Sample code provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community +**Sample code provided by** the [UtterAccess](https://www.utteraccess.com) community. @@ -146,7 +136,7 @@ End Sub The following example shows how to use the **BeforeUpdate** event of a form to require that a value be entered into one control when another control also has data. - **Sample code provided by:** The [Microsoft Access 2010 Programmer's Reference](https://www.wrox.com/WileyCDA/WroxTitle/Access-2010-Programmer-s-Reference.productCd-0470591668.html) +**Sample code provided by** the [Microsoft Access 2010 Programmer's Reference](https://www.wrox.com/WileyCDA/WroxTitle/Access-2010-Programmer-s-Reference.productCd-0470591668.html). @@ -483,7 +473,8 @@ Wrox Press is driven by the Programmer to Programmer philosophy. Wrox books are ## See also -[Access Object Model Reference](overview/Access/object-model.md) + +- [Access Object Model Reference](overview/Access/object-model.md) diff --git a/api/Access.ListBox.md b/api/Access.ListBox.md index 1ca0c1b35fe..0e2fad7f05e 100644 --- a/api/Access.ListBox.md +++ b/api/Access.ListBox.md @@ -37,10 +37,7 @@ You can use an unbound list box to store a value that you can use with another c If you don't have room on your form to display a list box, or if you want to be able to type new values as well as select values from a list, use a combo box instead of a list box. - **Links provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The[UtterAccess](https://www.utteraccess.com) community - - + **Links provided by** the [UtterAccess](https://www.utteraccess.com) community. - [Create a Query that uses a Multi-select Listbox as Criteria](https://www.utteraccess.com/forum/Creating-Query-Multi-t414388.html) @@ -59,8 +56,7 @@ In this example, a list box named ColorID displays a list of colors stored in th To do this, use the Change event of the text box to build a SQL statement that will serve as the new RowSource of the list box. - **Sample code provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community +**Sample code provided by** the [UtterAccess](https://www.utteraccess.com) community. @@ -249,14 +245,19 @@ End Sub |[Visible](Access.ListBox.Visible.md)| |[Width](Access.ListBox.Width.md)| -### About the contributors +### About the contributors -UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join. - +UtterAccess is the premier Microsoft Access wiki and help forum. ## See also -[Access Object Model Reference](overview/Access/object-model.md) +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) +- [Access object model reference](overview/Access/object-model.md) +- [SubForm object members](overview/Access.md) diff --git a/api/Access.SubForm.md b/api/Access.SubForm.md index 6c4bf1a45a1..230069f68d6 100644 --- a/api/Access.SubForm.md +++ b/api/Access.SubForm.md @@ -28,14 +28,6 @@ This object corresponds to a subform control. The subform control embeds a form > For example, you can use a form with a subform to present one-to-many relationships, such as one product category with the items that fall into that category. In this case, the main form can display the category ID, name, and description; the subform can display the available products in that category. Instead of creating the main form, and then adding the subform control to it, you can simultaneously create the main form and subform with a wizard . You can also create a subform by dragging an existing form or report from the Database window to the main form. - - **Links provided by:** -![Community Member Icon](../images/8b9774c4-6c97-470e-b3a2-56d8f786444c.png) The [UtterAccess](https://www.utteraccess.com) community - - -- [Create a Subform with Alternating Color Rows](https://www.utteraccess.com/wiki/index.php/Create_a_Subform_with_Alternating_Color_Rows) - -- [Referring To Properties And Controls On Subforms](https://www.utteraccess.com/wiki/index.php/Referring_To_Properties_And_Controls_On_Subforms) ## Events @@ -130,18 +122,26 @@ Instead of creating the main form, and then adding the subform control to it, yo |[Visible](Access.SubForm.Visible.md)| |[Width](Access.SubForm.Width.md)| -### About the contributors - -UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join. +### About the contributors -## See also +**Links provided by** the [UtterAccess](https://www.utteraccess.com) community. +- [Create a Subform with Alternating Color Rows](https://www.utteraccess.com/wiki/index.php/Create_a_Subform_with_Alternating_Color_Rows) + +- [Referring To Properties And Controls On Subforms](https://www.utteraccess.com/wiki/index.php/Referring_To_Properties_And_Controls_On_Subforms) +UtterAccess is the premier Microsoft Access wiki and help forum. +## See also -[Access Object Model Reference](overview/Access/object-model.md)
-[SubForm Object Members](overview/Access.md) +- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev) +- [Access help on support.office.com](https://support.office.com/search/results?query=Access) +- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx) +- [Access developer and VBA programming help center (FMS)](https://www.fmsinc.com/MicrosoftAccess/developer/) +- [Access posts on StackOverflow](https://stackoverflow.com/questions/tagged/ms-access) +- [Access object model reference](overview/Access/object-model.md) +- [SubForm object members](overview/Access.md) diff --git a/api/TOC.md b/api/TOC.md index 3c32a816b68..99ce639143f 100644 --- a/api/TOC.md +++ b/api/TOC.md @@ -1,5 +1,5 @@ # [Office VBA Reference](./overview/Index.md) -## [Access](./overview/Access.md) +## [Access](./overview/Access.md) ### Concepts #### Settings ##### [ActiveX Data Objects (ADO)](../access/Concepts/Settings/activex-data-objects-ado.md) @@ -19,31 +19,27 @@ ##### [Functions (alphabetical list)](../access/Concepts/Criteria-Expressions/functions-alphabetical-list.md) ##### [Functions (category list)](../access/Concepts/Criteria-Expressions/functions-category-list.md) ##### [Min, Max functions (Access SQL)](../access/Concepts/Criteria-Expressions/min-max-functions-microsoft-access-sql.md) -##### [Include quotation marks in string expressions](../access/Concepts/Criteria-Expressions/include-quotation-marks-in-string-expressions.md) ##### [Multiple fields in criteria expressions](../access/Concepts/Criteria-Expressions/multiple-fields-in-criteria-expressions.md) ##### [Numeric criteria expressions](../access/Concepts/Criteria-Expressions/numeric-criteria-expressions.md) ##### [Numeric criteria from a control on a form](../access/Concepts/Criteria-Expressions/numeric-criteria-from-a-control-on-a-form.md) -##### [Quotation marks in strings](../access/Concepts/Criteria-Expressions/quotation-marks-in-strings.md) +##### [Quotation marks in string expressions](../access/Concepts/Criteria-Expressions/include-quotation-marks-in-string-expressions.md) ##### [Restrict data to a subset of records](../access/Concepts/Criteria-Expressions/restrict-data-to-a-subset-of-records.md) ##### [Sort records in case-sensitive (ASCII) order](../access/Concepts/Criteria-Expressions/sort-records-in-case-sensitiveascii-order.md) ##### [StDev, StDevP functions (Access SQL)](../access/Concepts/Criteria-Expressions/stdev-stdevp-functions-microsoft-access-sql.md) ##### [Sum function (Access SQL)](../access/Concepts/Criteria-Expressions/sum-function-microsoft-access-sql.md) ##### [Textual criteria expressions](../access/Concepts/Criteria-Expressions/textual-criteria-expressions.md) ##### [Textual criteria from a control on a form](../access/Concepts/Criteria-Expressions/textual-criteria-from-a-control-on-a-form.md) -##### [Use multiple fields in criteria expressions](../access/Concepts/Criteria-Expressions/use-multiple-fields-in-criteria-expressions.md) -##### [Use numeric criteria in expressions](../access/Concepts/Criteria-Expressions/use-numeric-criteria-in-expressions.md) -##### [Use textual criteria expressions](../access/Concepts/Criteria-Expressions/use-textual-criteria-expressions.md) ##### [Var, VarP functions (Access SQL)](../access/Concepts/Criteria-Expressions/var-varp-functions-microsoft-access-sql.md) #### Error codes -##### [Error trapping](../access/Concepts/Error-Codes/error-trapping.md) -##### [Elements of run-time error handling](../access/Concepts/Error-Codes/elements-of-run-time-error-handling.md) -##### [Scoping and object-naming compatibility](../access/Concepts/Error-Codes/scoping-and-object-naming-compatibility.md) +##### [Comparison of data types](../access/Concepts/Error-Codes/comparison-of-data-types.md) ##### [Custom methods and properties](../access/Concepts/Error-Codes/custom-methods-and-properties.md) +##### [Elements of run-time error handling](../access/Concepts/Error-Codes/elements-of-run-time-error-handling.md) +##### [Error trapping](../access/Concepts/Error-Codes/error-trapping.md) ##### [Improvements in compilation performance](../access/Concepts/Error-Codes/improvements-in-compilation-performance.md) ##### [Macro actions and methods of the DoCmd object](../access/Concepts/Error-Codes/macro-actions-and-methods-of-the-docmd-object.md) -##### [Use enumerated constants in Access 2002 and later](../access/Concepts/Error-Codes/using-enumerated-constants-in-microsoft-access-2002-and-later.md) -##### [Comparison of data types](../access/Concepts/Error-Codes/comparison-of-data-types.md) -##### [Program with class modules](../access/Concepts/Error-Codes/program-with-class-modules.md) +##### [Programming with class modules](../access/Concepts/Error-Codes/program-with-class-modules.md) +##### [Scoping and object-naming compatibility](../access/Concepts/Error-Codes/scoping-and-object-naming-compatibility.md) +##### [Using enumerated constants in Access 2002 and later](../access/Concepts/Error-Codes/using-enumerated-constants-in-microsoft-access-2002-and-later.md) #### Structured Query Language (Access SQL) ##### Clauses ###### [FROM](../access/Concepts/Structured-Query-Language/from-clause-microsoft-access-sql.md) @@ -95,37 +91,37 @@ ##### [Retrieve records](../access/Concepts/Structured-Query-Language/retrieve-records-using-access-sql.md) ##### [Use international date formats in SQL statements](../access/Concepts/Structured-Query-Language/use-international-date-formats-in-sql-statements.md) #### Data Access Objects (DAO) -##### [Add a record to a DAO recordset](../access/Concepts/Data-Access-Objects/add-a-record-to-a-dao-recordset.md) -##### [Change tables involved in a one-to-many relationship in a DAO recordset](../access/Concepts/Data-Access-Objects/change-tables-involved-in-a-one-to-many-relationship-in-a-dao-recordset.md) -##### [Count the number of records in a DAO recordset](../access/Concepts/Data-Access-Objects/count-the-number-of-records-in-a-dao-recordset.md) -##### [Create a DAO recordset from a form](../access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-form.md) -##### [Create a DAO recordset from a query](../access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-query.md) -##### [Create a DAO recordset from a table in the current database](../access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-table-in-the-current-database.md) +##### [Add a record to a DAO Recordset](../access/Concepts/Data-Access-Objects/add-a-record-to-a-dao-recordset.md) +##### [Change tables involved in a one-to-many relationship in a DAO Recordset](../access/Concepts/Data-Access-Objects/change-tables-involved-in-a-one-to-many-relationship-in-a-dao-recordset.md) +##### [Count the number of records in a DAO Recordset](../access/Concepts/Data-Access-Objects/count-the-number-of-records-in-a-dao-recordset.md) +##### [Create a DAO Recordset from a form](../access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-form.md) +##### [Create a DAO Recordset from a query](../access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-query.md) +##### [Create a DAO Recordset from a table in the current database](../access/Concepts/Data-Access-Objects/create-a-dao-recordset-from-a-table-in-the-current-database.md) ##### [Create a user-defined property](../access/Concepts/Data-Access-Objects/create-a-user-defined-property.md) -##### [Delete a record from a DAO recordset](../access/Concepts/Data-Access-Objects/delete-a-record-from-a-dao-recordset.md) -##### [Detect the limits of a DAO recordset](../access/Concepts/Data-Access-Objects/detect-the-limits-of-a-dao-recordset.md) -##### [Extract data from a record in a DAO recordset](../access/Concepts/Data-Access-Objects/extract-data-from-a-record-in-a-dao-recordset.md) -##### [Find a record in a dynaset-type or snapshot-type DAO recordset](../access/Concepts/Data-Access-Objects/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset.md) -##### [Find a record in a table-type DAO recordset](../access/Concepts/Data-Access-Objects/find-a-record-in-a-table-type-dao-recordset.md) -##### [Find the current position in a DAO recordset](../access/Concepts/Data-Access-Objects/find-the-current-position-in-a-dao-recordset.md) -##### [Make bulk changes to a DAO recordset](../access/Concepts/Data-Access-Objects/make-bulk-changes-to-a-dao-recordset.md) +##### [Delete a record from a DAO Recordset](../access/Concepts/Data-Access-Objects/delete-a-record-from-a-dao-recordset.md) +##### [Detect the limits of a DAO Recordset](../access/Concepts/Data-Access-Objects/detect-the-limits-of-a-dao-recordset.md) +##### [Extract data from a record in a DAO Recordset](../access/Concepts/Data-Access-Objects/extract-data-from-a-record-in-a-dao-recordset.md) +##### [Find a record in a dynaset-type or snapshot-type DAO Recordset](../access/Concepts/Data-Access-Objects/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset.md) +##### [Find a record in a table-type DAO Recordset](../access/Concepts/Data-Access-Objects/find-a-record-in-a-table-type-dao-recordset.md) +##### [Find the current position in a DAO Recordset](../access/Concepts/Data-Access-Objects/find-the-current-position-in-a-dao-recordset.md) +##### [Make bulk changes to a DAO Recordset](../access/Concepts/Data-Access-Objects/make-bulk-changes-to-a-dao-recordset.md) ##### [Manipulate multivalued fields with DAO](../access/Concepts/Data-Access-Objects/manipulate-multivalued-fields-with-dao.md) -##### [Mark a position in a DAO recordset](../access/Concepts/Data-Access-Objects/mark-a-position-in-a-dao-recordset.md) -##### [Modify a query from a DAO recordset](../access/Concepts/Data-Access-Objects/modify-a-query-from-a-dao-recordset.md) -##### [Modify an existing record in a DAO recordset](../access/Concepts/Data-Access-Objects/modify-an-existing-record-in-a-dao-recordset.md) -##### [Move through a DAO recordset](../access/Concepts/Data-Access-Objects/move-through-a-dao-recordset.md) -##### [Read from and write to a field in a DAO recordset](../access/Concepts/Data-Access-Objects/read-from-and-write-to-a-field-in-a-dao-recordset.md) -##### [Return a random record from a DAO recordset](../access/Concepts/Data-Access-Objects/return-a-random-record-from-a-dao-recordset.md) +##### [Mark a position in a DAO Recordset](../access/Concepts/Data-Access-Objects/mark-a-position-in-a-dao-recordset.md) +##### [Modify a query from a DAO Recordset](../access/Concepts/Data-Access-Objects/modify-a-query-from-a-dao-recordset.md) +##### [Modify an existing record in a DAO Recordset](../access/Concepts/Data-Access-Objects/modify-an-existing-record-in-a-dao-recordset.md) +##### [Move through a DAO Recordset](../access/Concepts/Data-Access-Objects/move-through-a-dao-recordset.md) +##### [Read from and write to a field in a DAO Recordset](../access/Concepts/Data-Access-Objects/read-from-and-write-to-a-field-in-a-dao-recordset.md) +##### [Return a random record from a DAO Recordset](../access/Concepts/Data-Access-Objects/return-a-random-record-from-a-dao-recordset.md) ##### [Set properties of Data Access Objects in Visual Basic](../access/Concepts/Data-Access-Objects/set-properties-of-data-access-objects-in-visual-basic.md) -##### [Sort data in a DAO recordset](../access/Concepts/Data-Access-Objects/sort-data-in-a-dao-recordset.md) -##### [Synchronize a DAO recordset's record with a form's current record](../access/Concepts/Data-Access-Objects/synchronize-a-dao-recordset-s-record-with-a-form-s-current-record.md) -##### [Track design changes to a table-type DAO recordset](../access/Concepts/Data-Access-Objects/track-design-changes-to-a-table-type-dao-recordset.md) +##### [Sort data in a DAO Recordset](../access/Concepts/Data-Access-Objects/sort-data-in-a-dao-recordset.md) +##### [Synchronize a DAO Recordset's record with a form's current record](../access/Concepts/Data-Access-Objects/synchronize-a-dao-recordset-s-record-with-a-form-s-current-record.md) +##### [Track design changes to a table-type DAO Recordset](../access/Concepts/Data-Access-Objects/track-design-changes-to-a-table-type-dao-recordset.md) +##### [Use transactions in a DAO Recordset](../access/Concepts/Data-Access-Objects/use-transactions-in-a-dao-recordset.md) ##### [Work with attachments in DAO](../access/Concepts/Data-Access-Objects/work-with-attachments-in-dao.md) -##### [Use transactions in a DAO recordset](../access/Concepts/Data-Access-Objects/use-transactions-in-a-dao-recordset.md) #### ActiveX Data Objects (ADO) -##### [Bind a form to an ADO recordset](../access/Concepts/ActiveX-Data-Objects/bind-a-form-to-an-ado-recordset.md) -##### [Set properties of ActiveX Data Objects in Visual Basic](../access/Concepts/ActiveX-Data-Objects/set-properties-of-activex-data-objects-in-visual-basic.md) +##### [Bind a form to an ADO Recordset](../access/Concepts/ActiveX-Data-Objects/bind-a-form-to-an-ado-recordset.md) ##### [Create an ADO connection string](../access/Concepts/ActiveX-Data-Objects/create-an-ado-connection-string.md) +##### [Set properties of ActiveX Data Objects in Visual Basic](../access/Concepts/ActiveX-Data-Objects/set-properties-of-activex-data-objects-in-visual-basic.md) #### XML ##### [Export a report to XML](../access/Concepts/XML/export-a-report-to-xml.md) ##### [Export data, schema, and related tables to XML](../access/Concepts/XML/export-data-schema-and-related-tables-to-xml.md)