Results 1 to 7 of 7
  1. #1
    kent is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    34

    Synchronize scrollbars on two textboxes?

    I have a form with two textboxes with the same number of lines in each. I need for the text box on the right to move to whatever position the text box on the left's scrollbar. I can't use a listbox because I need to select text within the box across multiple lines.



    I found this example, although it pertains to two subforms instead of two controls on a box: http://www.rogersaccesslibrary.com/f..._topic566.html

    Does anyone know if there's a straightforward way to make two textboxes scroll together?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    a scrollbar is the property of an object. The principles for subforms should also apply to textboxes. Suggest try modifying the code you have found to reference the textbox rather than a subform.

    However since textboxes can scroll without using the scrollbar (i.e. using the up/down arrows) you may need additional code to capture those events as well.

    You might also have issues around text length - if the text in one textbox is longer than the other (at least in terms of number of lines) then the ability to sync scrolling become more difficult, you would need to prorata the scroll move

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    If you can do it, I suspect it will only be via an API because this is a Windows level thing, not an Access one. Try searching on some phrases like
    ms access textbox scroll position

    I got this in the results, which seems to point in the direction needed but it is an unresolved thread. Maybe it will point you in the needed direction:

    https://bytes.com/topic/access/answe...extbox-control
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I see Stephen Lebans responded to that thread provided by Micron.
    This code from Stephen's site may allow you to achieve your aim http://www.lebans.com/SelectRow.htm
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    kent is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    34
    I was looking at the code examples and noticed that they are on the form level, not on the object on the form. But I also was thinking, would it make sense to use Active X textboxes and use a single scrollbar to control both text boxes?

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You might be giving up on too easily on what I posted. I noticed the LeBans thing related to a form, which is why I didn't suggest it. However, I think my link was a jumping off point in which you'll need to do the detective work. Considering the answer given, I thought OK, what's needed might be a way to get the control Hwnd value so I Googled that and came up with
    http://access.mvps.org/access/api/api0027.htm

    I'm going to have to stop there and let you carry on with the crumb trail before momma gives me the evil eye.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    And another possibly useful link https://codekabinett.com/page.php?Th...ollBars-Sample.

    I would recommend you avoid using ActiveX controls
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Synchronize Sharepoint Lists
    By jerem in forum SharePoint
    Replies: 7
    Last Post: 07-15-2014, 10:54 AM
  2. Displaying scrollbars in embedded Excel object
    By FelicianoRa@coned.com in forum Forms
    Replies: 1
    Last Post: 01-28-2013, 01:11 PM
  3. Datasheet Scrollbars
    By Paul H in forum Forms
    Replies: 11
    Last Post: 10-21-2011, 09:29 AM
  4. Replies: 5
    Last Post: 09-29-2011, 04:11 PM
  5. Scrollbars on a sub form
    By Paul H in forum Access
    Replies: 3
    Last Post: 09-12-2011, 01:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums