Synchronize subform scrolling

J

Jeff Hunt

I have a continuous subform that has many fields on it, so you have to scroll
horizontally to view all the data. I would like to "anchor" two key fields
(account numbers) on the left side, to produce an effect like "freeze panes"
in Excel (or like having a "form header" on the left side of the screen
instead of the top). My thought to solve this was to have two different
subforms based on the same data, with the left one showing only the account
numbers, and the right one containing everything but the acct numbers. The
problem with this is when there are more records than fit vertically in the
subform, the left and right forms get out of sync when you scroll one form.
While researching this, I found the following code in the forum:

Private Sub Form_Current()

Dim rs As DAO.Recordset

If (Not IsNull(Me![ID])) And _
(Not IsNull(Parent.OtherSubFormControl.Form![ID])) And _
(Me![ID] <> Parent.OtherSubFormControl.Form![ID]) Then
Set rs = Parent.OtherSubFormControl.Form.RecordsetClone
rs.FindFirst "ID = " & Me![ID]
If Not rs.NoMatch Then
Parent.OtherSubFormControl.Form.Bookmark = rs.Bookmark
End If
End If

End Sub

However, this only seems to make sure that both matching records are visible
in each form, and only if I click on one. It does not actually synchronize
the scrolling with the scroll wheel or scroll bars, and in a large subform
the lines are frequently out of alignment between the forms. Is such
scroll-linking possible? If not, is there some way to get the "freeze panes"
look I want on my subform?
 
J

John W. Vinson

I have a continuous subform that has many fields on it, so you have to scroll
horizontally to view all the data.

Ummm... any reason not to use a continuous form with two or three rows of
controls?
 
M

Marshall Barton

Jeff said:
I have a continuous subform that has many fields on it, so you have to scroll
horizontally to view all the data. I would like to "anchor" two key fields
(account numbers) on the left side, to produce an effect like "freeze panes"
in Excel (or like having a "form header" on the left side of the screen
instead of the top). My thought to solve this was to have two different
subforms based on the same data, with the left one showing only the account
numbers, and the right one containing everything but the acct numbers. The
problem with this is when there are more records than fit vertically in the
subform, the left and right forms get out of sync when you scroll one form.


See if this can do what you want:
http://www.lebans.com/setgetsb.htm
 
J

Jeff Hunt

Mostly preference. With multiple rows, the column labels in the subform
header would not line up, or there would have to be multiple rows there as
well. Basically I think it would look cluttered, and since several fields
have similar data in them, it could be confusing to the user. Thanks for the
suggestion though.
 
J

Jeff Hunt

That looks like it could work. Now I just need to figure out HOW it works
enough to add it into my existing forms. I'll reply back again if I'm stuck
and still want to try this. I'm still open to any other suggestions out
there as well.
 

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

Top