Listbox horiz scollbar (1 Viewer)

kirkm

Registered User.
Local time
Tomorrow, 00:41
Joined
Oct 30, 2008
Messages
891
I found the following on another Forum

Access will automatically add a horizontal scrollbar if the column width exceed the width of the listbox.

It's either wrong, or there's more to it as my listbox does not show a H scrollbar (it does show a verticle one)
Nor does it wordwap, so much of it dissapears off the RH side.
There's one column only and I've tried various column widths (> listbox width, = listbox width <listbox width). Nothing changes
What sort of solutions exist ? Or must you limit the size of text per line yourself ?
Thanks
 

kirkm

Registered User.
Local time
Tomorrow, 00:41
Joined
Oct 30, 2008
Messages
891
There's one column only and I've tried various column widths (> listbox width, = listbox width <listbox width). Nothing changes
 

pisorsisaac@gmail.co

Active member
Local time
Today, 05:41
Joined
Mar 14, 2017
Messages
932
I think this issue has been very finicky in Access over time. People have their opinions on when it does or doesn't show and they are all both right and wrong, as mileage seems to vary. One thing to try is binding the rowsource to a table or query, rather than a Values list. that seems to work for some people, although I just tried it and it did not work for me. Others claim it is a matter of having more than one column, a single column won't 'trigger' the scrollbar. I would try those two things and see if you get anywhere, just some ideas.

You may have to adjust your listbox to be wide enough
 

kirkm

Registered User.
Local time
Tomorrow, 00:41
Joined
Oct 30, 2008
Messages
891
Thanks for the information
Seems very mickey mouse for something you pay a lot of $$$ for !
Not really practical to change listbox width all the time.
How have others handles this?
 

Micron

AWF VIP
Local time
Today, 08:41
Joined
Oct 20, 2018
Messages
3,123
I think you need to have more than 1 column and the sum of the widths must be greater than the control width. If the rowsource is a query, you probably can get by with an extra column, but if it's based on a table, then probably not. You won't want to see the extra columns that will automatically be pulled in from the table, and you can't set them to 0" otherwise you're back to square one.
EDIT - you will likely be able to scroll over to the next column, which means its width would need to be very small. Not sure what the effect would be regarding whether or not the first column disappears entirely.
 

kirkm

Registered User.
Local time
Tomorrow, 00:41
Joined
Oct 30, 2008
Messages
891
Thanks.. but going slightly mad here trying to put a value into Col2 !
Most examples show e.g. .AddItem "1;2;3" but I have a variable to add.

Any idea what's wrong with this? Was only thing I could find but no work.
Code:
                        For i = 0 To UBound(Dat) - 1
                        x = Me.Parent.List1.ListCount
                            Me.Parent.List1.list(x, 1) = Dat(i)
                        Next
 

Micron

AWF VIP
Local time
Today, 08:41
Joined
Oct 20, 2018
Messages
3,123
Well, you've lost me. First you had one column, now you're trying to add as many columns as there are rows in the list? Doesn't sound like what I suggested so maybe pisorisaac can help.
 

kirkm

Registered User.
Local time
Tomorrow, 00:41
Joined
Oct 30, 2008
Messages
891
I added a 2nd column (you said I think you need to have more than 1 column). You're right That did show a Horizontal scrollbar. Now I'm attempting to add the data to see if 2 columns will work out ok. One really small and one larger holding the data. It's nothing to do with adding columns to equal rows. List(x,1) was someones suggestion where x is the next current row and 1 is col2. But maybe that was some other listbox, not Access, as it didn't work. Nor did the the semicolon idea. Think I'll have a beer and call it a day!
 

Micron

AWF VIP
Local time
Today, 08:41
Joined
Oct 20, 2018
Messages
3,123
I was guessing that if
- a listbox rowsource is based on a single field query
- and the listbox has width of 2" and a column count of 2
- and the column widths are (e.g.) 2";0.0007"
then a scroll bar would appear. However, you will be able to scroll into the 2nd column, which may look odd, and you will not be able to scroll within a column, only from column to column. I think the best approach for a single column listbox would be to have the column and control the same width or use some other method. If you don't need multi select capability, then a combo would be better. You can make the control one width and the list much wider if space is an issue, but you still can't scroll withing a column if that's what you're after.
 

kirkm

Registered User.
Local time
Tomorrow, 00:41
Joined
Oct 30, 2008
Messages
891
You know, I thought this would be easy. A control that holds text and lets you scroll L=R and Up-down to fit the text.
Just seems so basic it's plain ridiculous it doesn't work. Bunch of flamin' nutters who design this stuff!
Anyway I've changed to a Listview. It's not perfect but better. Horiz scrollbar works better and with one column, but is always present. If you exceed the column width allocated, text is truncated. Colum headers will let you drag wider, but they're not wanted. Always a bloody compromise isn't it !
Thanks for replies/ideas :)
 

Micron

AWF VIP
Local time
Today, 08:41
Joined
Oct 20, 2018
Messages
3,123
Trying to think of an example of any single control/field in any app (not a web page) that has a horizontal scroll bar. Can't at the moment.
I guess everyone is just used to using the arrow key to see whatever doesn't fit within the width? As for up/down, that's automatic in Access for most controls unless you specifically disable the feature; even the lowly textbox.
 

kirkm

Registered User.
Local time
Tomorrow, 00:41
Joined
Oct 30, 2008
Messages
891
I suppose one should be grateful the vertical scrollbar does what's expected ! Not a good day for coding LOL. But thanks for the feedback, keeps on sane.
Listview properties offer a 'Flat' Special Effect but doesn't seem to work, nor does Border Style.
 

pisorsisaac@gmail.co

Active member
Local time
Today, 05:41
Joined
Mar 14, 2017
Messages
932
Doesn't sound like what I suggested so maybe pisorisaac can help.
Unfortunately what I already suggested, several ways, is about all I can think of. And if they helped you see the scrollbar - AWESOME. I was unable to get ANY of these methods to show me a h. scrollbar in a quick test. Whether I used Values list, Table/Query, more than 1 col.,, exceeding width of listbox, etc. Like I said - this is a very finicky issue. If you get it to work say a prayer and leave it alone.

PS..there is probably somebody out there like Lebans who has come up with some special method, you might search around for it
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom