![]() The following macro first opens the Categories table by using the OpenTable action. The FindRecord action only matches strings that equal, start with, or contain the string being searched for. You can use logical operators, such as, AND, OR, and BETWEEN. In the preceding example, neither Description nor CategoryID must be displayed on the form or report for the criteria to work. You can refer to fields that are in the record source of a form or report but aren't displayed on the form or report. You can use complex criteria in the Where Condition argument, such asĭescription = "Beverages" and CategoryID = 11 The following list demonstrates some things you can do with the SearchForRecord macro action: The SearchForRecord macro action uses criteria that are more like those of a filter or an SQL query. The FindRecord macro action is primarily used for finding strings, and it duplicates the functionality of the Find dialog box. The SearchForRecord macro action is similar to the FindRecord macro action, but SearchForRecord has more powerful search features. To run the SearchForRecord action in a VBA module, use the SearchForRecord method of the DoCmd object. To confirm that a match was found, you can enter a condition for the next action, and make the condition the same as the criteria in the Where Condition argument. If there are no further records that match the criteria, no error occurs and the focus remains on the current record. When searching for the previous or next record, the search does not "wrap" when it reaches the end of the data. If the criteria in the Where Condition argument are not met, no error occurs and the focus remains on the current record. The object specified in the Object Name argument must be open before this action is run. The sort order of the records For example, if the Record argument is set to First, changing the sort order of the records might change which record is found. The Record argument setting See the table in the Settings section for more information about the Record argument. In cases where more than one record matches the criteria in the Where Condition argument, the following factors determine which record is found: Note the equal sign ( =) at the beginning of the expression, and the use of single quotation marks ( ') on either side of the text box reference: For example, the following criterion will search the Description field for the value in the text box named txtDescription on the form named frmCategories. To create a criterion that includes a value from a text box on a form, you must create an expression that concatenates the first part of the criterion with the name of the text box containing the value for which to search. This is the default value for this argument.Įnter the criteria for the search using the same syntax as an SQL WHERE clause, only without the word "WHERE". Specify the starting point and direction of the search. The drop-down list shows all database objects of the type you selected for the Object Type argument. You can select Table, Query, Form, or Report.Įnter or select the specific object that contains the record to search for. The SearchForRecord macro action has the following arguments.Įnter or select the type of database object that you are searching in. You can use the SearchForRecord macro action in Access desktop databases to search for a specific record in a table, query, form or report. Access for Microsoft 365 Access 2021 Access 2019 Access 2016 Access 2013 Access 2010 Access 2007 More. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |