scrolling to a field in a continuous form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
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

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]
 
John W. Vinson said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top