I quit using, or answering questions about "DoMenuItem" some time ago.
If you want to find the record with a particular value in a Control on the
currently-displayed form, you might try:
Me.RecordsetClone.FindFirst "[yourfieldname] = """ & Me.yourcontrolname
& """"
Me.Bookmark = Me.RecordsetClone.Bookmark
(Of course, you must replace yourfieldname with the name of the Field in
your Record and you must replace yourcontrolname with the name of the Field
on your Form.)
(This code assumes the field of interest is text, so the argument of
FindFirst must be in quotation marks. If it is a numeric field, eliminate
two of the string of three quotes, and the entire & """" at the end of the
string.)
(And, a final "of course", the record of interest must exist in the Form's
RecordSource.)
Larry Linson
Microsoft Access MVP
"AA Arens" <ba***********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
I use the undermentioned code to find a record in a predefined "Look
In" field:
Private Sub Command137_Click()
On Error GoTo Err_Find_Record_Click
Me.CompanyName.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
However, the Look In field of the find-record dialog
box is first set a the form name, not the field name as mentioned in
the code (SetFocus).
Though, it happens only when I approached the form for the first time
after I
start Access. Why?
Bart