Width of list box

Kiwi-Wombat

Registered User.
Local time
Yesterday, 19:44
Joined
Aug 2, 2004
Messages
56
I have a form with several list boxes. There are occassions when I want to change the width of them. There is no question that the width changes but it places a horizontal scroll bar which I don't want.

I have ensured that the total width of the columns is smaller than the width of the list box but that didn't help

Anyway to prevent it happening?
 
Does the scroll bar go away when the width of the list box is greater than the combined width of the columns?

ken
 
No.

Subseqently I have tried this with a mock up form and it seems to work OK but in my real one it doesn't.

Could it have something to do with the filed size in the table it is looking up.

I will do some further mock-ups to see if I can duplicate it elsewhere
 
Attached is a sample database using Access 2000. Access 97 is the same

Form1 has the list box width set at 12cms. 3 Columns

Form 2 is an exact duplicate except that the list box is set at about 5cm and the event "on current" changes the width to 12 cms

Both list boxes are visually the same width when open but one has a scroll bar

What is causing this
 

Attachments

Hiya,

Have had a look at your sample and had the same problem. Try using a slightly oversized column width than you actually think. Ie, when column widths are 0cm;4cm;4cm, use a total column width of 8.01cm.
 
In this case the columns total 11cm and the list box 12cm

I asked this question on another forum as well and the answer I got was to also resize the columns

ie

'Redefine widths columns 2 and 3
Dim lngCW2 As Long
Dim lngCW3 As Long
lngCW2 = 3.15 * 1440 'convert inches to twips
lngCW3 = 1.1813 * 1440 'convert inches to twips
PartsOrderList.ColumnWidths = "0;" & lngCW2 & " ;" & lngCW3
End Sub

This now works. Don't know why you have to do this though
 

Users who are viewing this thread

Back
Top Bottom