If you want to use the Find dialog to search the particular field, you will
need to leave its Enabled property to Yes. You can set Locked to No if you
wish. Set TabStop to No so that the user doesn't go there when tabbing
through the controls on the form if that helps.
The alternative would be to add an unbound control to the form, so the user
can type a number there, and press Enter to find the record without ever
needing to open the Find dialog. Use the AfterUpdate event of this text box
to FindFirst in the RecordsetClone of the form, and if found jump to that
record.
The event procedure would look something like this:
Sub txtGoTo_AfterUpdate ()
Dim rs As DAO.Recordset
If Not IsNull(Me.txtGoTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.txtGoTo
If rs.NoMatch Then
MsgBox "Not found"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
message
I have a statement form that contains an autonumber field for the statement
number. I want this field to be disabled or locked so that users don't go
into it, but I would like to be able to use Find within this field to
search
for a specific statement number. How can I do this?
Thanks so much!
Sandra G