Results 1 to 12 of 12
  1. #1
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176

    Scroll bar to only show when needed in text box

    I have a text box where the text may or may not fit. I can show the vertical scroll bar to allow me to scroll through all the text. But, I don't want the scroll bar to be visible if there is no need.


    I searched the internet and found the following for :Microsoft Office Access 2003

    • Click the Format tab, and do one of the following:
      • To specify that scroll bars never appear in the text box, set the Overflow, OverflowX, and OverflowY properties to Hidden.
      • To specify that scroll bars appear in the text box only when necessary, set the Overflow, OverflowX, and OverflowY properties to Auto.
      • To add a vertical scroll bar to a text box, set the OverflowX property to Hidden and the OverflowY property to Scroll.
      • To add a horizontal scroll bar to a text box, set the OverflowX property to Scroll and the OverflowY property to Hidden

    However, there do not appear to be any such properties in Access with Office 365. Has this functionality been removed, or are they perhaps hidden properties that can only be set from VBA?


    Ideally of course, I want to be able to disable the text box if all the data fits, so I don't have to see the annoying cursor either. Even with the scroll bar, I don't need to see the cursor, as the text is locked.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Never head of 'em. Not seeing options in Access 2010.

    What cursor? The one that shows in textbox when it has focus? Why does a locked textbox have focus?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,980
    Quote Originally Posted by Miles R View Post
    I have a text box where the text may or may not fit. I can show the vertical scroll bar to allow me to scroll through all the text. But, I don't want the scroll bar to be visible if there is no need.
    I searched the internet and found the following for :Microsoft Office Access 2003


    • Click the Format tab, and do one of the following:
      • To specify that scroll bars never appear in the text box, set the Overflow, OverflowX, and OverflowY properties to Hidden.
      • To specify that scroll bars appear in the text box only when necessary, set the Overflow, OverflowX, and OverflowY properties to Auto.
      • To add a vertical scroll bar to a text box, set the OverflowX property to Hidden and the OverflowY property to Scroll.
      • To add a horizontal scroll bar to a text box, set the OverflowX property to Scroll and the OverflowY property to Hidden

    However, there do not appear to be any such properties in Access with Office 365. Has this functionality been removed, or are they perhaps hidden properties that can only be set from VBA?
    Those properties were for Data Access Pages - a feature that has long been deprecated

    The A2003 info for textboxes in a form was:
    Click the Format tab, and in the ScrollBars property box, do one of the following:

      • To specify that a scroll bar for a text box never appears, click None.
      • To specify that a scroll bar for a form never appears, click Neither.
      • To specify that a vertical scroll bar for a text box always appears, click Vertical.
      • To specify that a vertical scroll bar for a form appears when necessary, click Vertical Only.
      • To specify that a horizontal scroll bar for a form appears when necessary, click Horizontal Only.
      • To specify that both vertical and horizontal scroll bars appear when necessary, click Both.
    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

  4. #4
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176
    A locked textbox can have focus. It just means the data can't be changed, but it needs focus if you need to scroll up and down the locked data. If the text box is disabled, then it can't have focus and you don't see the cursor (and you can't scroll up and down either).

  5. #5
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176
    Thanks for the reply. Yes, I thought as much. Its a pity though, because on forms and such, the scroll bar only appears when needed.
    Don't see why that feature should have been removed from text boxes though - there is no point in seeing a scroll bar if it does not do anything.
    In your reply though, you specify the option could be Vertical Only - which is what I want. I can't see that option though - just Vertical or None (typing Vertical Only is not accepted in the field).

    Actually, I suspect the reason this option is not available, is because it can't tell whether the text is too big for the text box, so can't decide if the scroll bar is needed or not, so it always displays it if specified.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    A textbox has only one scrollbar - vertical. Vertical means Vertical Only. Just select Vertical from the dropdown.

    If you don't click or tab into textbox, there is no cursor displayed in it. Can still click scrollbar even though it is not showing, the space for it is reserved. However, clicking on scrollbar when cursor is not positioned within textbox highlights all text. So which is less objectionable?

    Never removed from normal forms. Data Access Pages was a feature of web database.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176
    Thanks for the reply, but I am fully aware that a textbox has only a Vertical scroll bar, and I am using it.
    But, as far as I can see from my own use, Vertical does not mean Vertical Only, as in IslaDogs reply, because if it did, the scroll bar would only be visible if needed.
    If you select Vertical, the scroll bar is always visible, whether needed or not - at least it is on my system.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    The Only part of VerticalOnly and HorizontalOnly does not mean "show only if needed" it means "only available"; and yes, if any form scrollbars are available they show only if needed. Therefore, Vertical means VerticalOnly because only vertical is available. Unfortunately, "if needed" is not programmed into textbox scrollbar.

    If Data Access Pages could conditionally display textbox scrollbar, one would think this could be programmed for a normal form and textbox.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176
    Yes, I think the answer to why it is not programmed into a textbox maybe as I suspected earlier. i.e. It is difficult to determine with a normal font how many lines the text takes up, so it does not know whether a scroll bar would be needed.
    I have tried in vain to determine this myself in the past. It is easier, with Fixed Width fonts such as Consolas, which I often use.
    Having said that, I am sure behind the scenes it must know how many text lines there are, as it obviously fills the text box with the lines.

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,980
    Several years ago I was involved in a similar thread at another forum. I've just managed to find that thread which contains solutions for both single forms & continuous forms.
    As it isn't possible to change the default behaviour, each involves a work-around but may be good enough for your needs.
    https://www.access-programmers.co.uk...xt-box.294529/

    Hopefully you will find one of those useful

    Also, you can determine the exact width of a section of text no matter which font is used. To do so, use the multi-purpose Wizhook function which is a hidden & undocumented function used in Access wizards.
    See my article which covers (amongst many other items) its GetTwipsFromFont feature: https://www.isladogs.co.uk/wizhook/
    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

  11. #11
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176
    Thanks again for the reply. I did come across that thread in my searches. I'm not sure its the same issue, as I'm more concerned about not showing the scroll bar in a text box, rather than showing it.
    I was not aware of the Wizhook function and it could be used to determine the number of rows with a bit of effort probably. A lot of effort I think.

    Ideally, what I would have liked is the following :-
    1. Only show the Vertical Scroll bar if the text has too many lines to fit in the text box.
    2. Never show the blinking cursor in the text box.

    Its not really worth the effort of trying to get that to work. I can live with the cursor, and mostly I don't even show the scroll bar. I just use the SendKeys "{UP 16}" and SendKeys "{DOWN 16}" on the mouse wheel to scroll the text.
    It works pretty well.

  12. #12
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,980
    I agree that its not worth the time and effort in trying to get this to work as you wanted.
    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. Replies: 2
    Last Post: 03-30-2019, 03:36 PM
  2. Mouse scroll in text box AND form
    By veejay in forum Modules
    Replies: 1
    Last Post: 01-18-2019, 03:07 PM
  3. text box scroll
    By Jen0dorf in forum Access
    Replies: 4
    Last Post: 02-11-2016, 01:55 PM
  4. Replies: 2
    Last Post: 09-10-2015, 03:21 PM
  5. Scroll bars do not show in dialog form
    By AsjenW in forum Forms
    Replies: 3
    Last Post: 05-17-2013, 08:26 AM

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