Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.FindRecord - doesn't report No Find conditions.

Status
Not open for further replies.

howardb1

IS-IT--Management
Jun 1, 2001
6
US
The Find function in the menu and button bar display a message box when there are no more matches for the specified search criteria. However, ths DoCmd.FindRecord doesn't do this, and none of the documentation I've seen so far on the DoCmd.FindRecord command covers how to determine if a match isn't found.

Given the background that follows, what is the best way to implement the FindRecord and still achieve the interactive behavior of the regular find, including No Match message and selecting the text when matches are found.

Here's the background:

1)I'm using MS Access 2000 sp 1.

2) I'm using a custom Find form that adds new features to the regular Find command, such as changing the default setting and allowing the user to choose to search the main or subform. I "install" my custom Find form when the main data entry form starts up by seting the action propery of the Find button on the button bar to my macro that implement my custom Find form and its code. When the data entry form closes it clears the action property of the Find button on the button bar so that it works normally the rest of the time.

3) I use the DoCmd.FindRecord command to perform the actual search. I'm using the DoCmd version rather than the recordset version because I want my data entry form to be updated with the results of the search when the user clicks the modified Find button on the button bar.

4) My application is a multiuser database that uses an Access 2000 backend database and a Access 2000 frontend which links to the tables in the backend.

5) I tried using the NoMatch property of the form's record set object, but it's always false - indicating that a march was found even when one was not. Now, I'm using the before and after conditions of the AbsolutePosition, the ActiveControl's Name, SelStart, SelLength, and SelText properties to determine if their values have changes when the FindRecord command is run. This works for forms that don't contain subforms. However, these attributes aren't always available for all of the controls that the ActiveControl object may point to, and this causes the program to error.

6) I've overcome virtually all of the other issues associated with the DoCmd.FindRecord, such as previous highlighted matches not consistantly being de-hightlighted when another match is made in the same record. So, I really want to make this work if possible.
 
You can use the DLookup function to get the value of a particular field from a specified set of records

This is just a simple example but you can get more info in the help menu.

Dim varX As Variant
varX = DLookup("[CompanyName]", "Shippers", "[ShipperID] = 1")
 
im trying to put a find record command button on my form but when you click on it it comes with menu options are find , replace, whole field any part of field current field or all what expression should i use to so when pressed you can type just one thing and it will look thru all fields and all records without having to change anything to search for it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top