AccessVB: Moving scrollbar of subform using vb

Posted on 2009-04-24
Medium Priority
Last Modified: 2013-11-27
I have 2 subforms that are exactly the same size and that look at the same table. (They are titled: "Subform1" and "Subform2")

What VB code would I use so that when I press a button, it looks at the scrollbar on "Subform1" and moves the scrollbar to the exact same location on "Subform2".
Question by:ouestque
  • 3
  • 2

Accepted Solution

coffeeshop earned 2000 total points
ID: 24225335
You want to synchronize both? I don't  know how to activate the scrollbar with code. Think this can only be done with some windows API calls. Maybe another expert has a solution for this.

But what you can do is to Bookmark the same record in both forms. I asume that you show the same data, meaning the same count of rows, if you want to synchronize. If so, you can do it by setting the same AbsolutePosition in both forms.

YourForm1.Recordset.AbsolutePosition = YourForm2.Recordset.AbsolutePosition

Open in new window


Author Comment

ID: 24225881
Thanks Coffeeshop, this will make both subforms set to the same record, but sometimes the record will appear on the top in one subform2 and in another location in another subform1.

i.e.( if you select record 2 in subform1, then select record 5000 in subform2, they are both focused on the same record, but subform2 is showing the selected record at the top, while subform1 is showing the record in the middle of my subform.)

My theory is that it refreshes the record in subform 2 to the top, because the user had to scroll down to choose that record.

Is there a way to make them both appear in the same location. (i.e. reason for adjusting scrollbar.)

Assisted Solution

coffeeshop earned 2000 total points
ID: 24226117
I do this by doing a requery in both forms before I set the position. But the possibilities to synchronize in a user-friendly way are very limited, I had a lot of hassle with this.

I know a solution with API, take a look at


its in german language, just translate with google.

This solution sync the horizontal scrollbars, but it did not work 100% in all cases as I testet some time ago. Think its a little overhead.

Author Comment

ID: 24244347
Holy Moly! I took a look at the German version of the code and it is very scattered and hard to understand. It appears to work on the German guy's program. It will be tough to adapt that to my forms...

Author Comment

ID: 24270764
Does anyone know if this is the simplist way to achieve what I am doing?

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question