Error with Find Record

Ian Stuart

New member
Local time
Today, 03:11
Joined
Aug 27, 2003
Messages
6
I am using the following code to find a record on a form:

Me.txtFindString.SetFocus

If IsNull(Me.txtFindString) Then
MsgBox "Please enter a search string", vbOKOnly
Else
DoCmd.FindRecord Me.txtFindString, acAnywhere, , acSearchAll, , acAll, True
End If


and get the following error:

"A macro set to one of the current field's properties failed because of an error in a FindRecord action argument."

Any ideas?... I don't have any macros
 
try
DoCmd.FindRecord Me.txtDescription, acAnywhere, False, acSearchAll, True, acAll, True
 
That gets rid of the error message thanks (I just found errmsg.xls which was very helpful as well)

Unfortunately the search still doesn't work! It only seems to search for the text on the current record not all records
 
got it...it was finding the text in the search string text box!!!

Any way of omitting that field (only) from the search criteria?
 
Why don't use use something like

Private Sub YourComboName_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.RecordsetClone
rs.FindFirst "[YourFieldName] = " & Str(Me![YourComboName])
Me.Bookmark = rs.Bookmark
End Sub


This is a simple search .. i think it works

As long as it is an unbound search box.

Steve
 
Surely that will only find text in a particular field? Presumably I would need to create a loop to go through all the fields on the form except the one(s) I didn't want to search.

I am thinking that it may be easier to use the built in find dialog box...I just don'tlike the default options (such as "Whole Field")
 

Users who are viewing this thread

Back
Top Bottom