I have a large continuous form filled with a bunch of fields containing text.
The user would like to be able to type in the contents of one of the fields
and have the form scroll to that point.
My first attempt was to put an unbound field at the top, when you type into
it is loops over the form using SelTop to see if it can find it.
Is there an easier way?
Maury
>I have a large continuous form filled with a bunch of fields containing text.
>The user would like to be able to type in the contents of one of the fields
[quoted text clipped - 6 lines]
>
>Maury
One would be to have a Combo Box to *select* the value of the field, and
filter the form to show just that record.
Or, you can use code like this in the control's AfterUpdate event:
Private Sub controlname_AfterUpdate()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[fieldname] = '" & Me.controlname & "'" <<< text fields
- or -
rs.FindFirst "[fieldname] = " & Me.controlname <<< numeric fields
- or -
rs.FindFirst "[fieldname] = #" & Format(Me.controlname, "mm/dd/yyyy") & "#"
<<< date fields
If rs.NoMatch Then
MsgBox "No such record found!"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub
John W. Vinson [MVP]
Maury Markowitz - 27 Jul 2007 15:44 GMT
> Me.Bookmark = rs.Bookmark
Ah ha! I think this is the key I was looking for.
I did go ahead and implement it "the hard way" anyway, and it actually works
fine as long as you turn off echo.
Maury