Remove Horizontal Scrollbar from Listbox

scalextric59

Registered User.
Local time
Today, 02:36
Joined
Dec 20, 2008
Messages
87
I need to remove the horizontal scrollbar from a listbox. I have tried code that uses API and the .hwnd method, but I get the error "Method or Data Member Not Found". What would be the right approach to accomplish this?

Thank you.
 
Are you sure it is a listbox? I just placed a listbox with the data wider than the control and no horizontal scroll bar appeared. The vertical scrollbar was present when the box was not high enough.

I'm using Access 2007 with a 2002-3 database.
 
Yes, it is a listbox. I think the horizonatl scrollbar is related to the number of columns. If all the columns do not fit in the list, then you get the scrollbar.
I am using Access 2003 Professional.
 
Just added another column and still no scrollbar.
Tried every kind of RowSource.

Want to copy your textbox onto a form and attach it here?
 
I just created a form that show the listbox with the horizontal scrollbar
 

Attachments

No scrollbars showing on my system.

One of my early posts here was about a form that refused to initialise with a scrollbar. Everyone agreed it should be showing. One day it just started working again.

The mysteries of Access.
 
Amazing. So, you only see the name and part of the address? Is there any way see the remaining columns?
 
The Horizontal Scroll bar becomes visible (auto-magically) whenever the total column width exceeds, by a certain amount, the width of the List box. There are a two ways to solve this; A) increase the width of the list box, B) adjust the column widths until they fit neatly within the width of your list box.
 
Yes, that would be the easy solution, but the user has restrictions on the form size. Moreover, they can add and remove fields to the list, modify the column order, sort, etc. I already have the logic that handles the horizontal scrolling, I just need to hide the scrollbar that appears automatically.
 
The Horizontal Scroll bar becomes visible (auto-magically) whenever the total column width exceeds, by a certain amount, the width of the List box.

It isn't quite that simple. There is some kind of very weird formula. It can not be there when a vast amount that can't be viewed and suddenly appear when made a tiny bit smaller.

There is hysteresis in the behaviour. Once it appears it will stay visible until most of the colums are in view. Once disappeared it can sometimes stay hidden with just a column and a half showing. I'm not sure but it seems to matter where in the column is mouse is released.

If you go to Layout view (maybe only available in Access 2007 ?) its bizarre behaviour can be easily observed.

Perhaps there is some similar relationship in my original problem with the vertical scrollbar not appearing on a form. I suspect this problem went away after I messed with the row height.
 

Users who are viewing this thread

Back
Top Bottom