Combo Box List Format

  • Thread starter Thread starter MRP as MR P
  • Start date Start date
M

MRP as MR P

I have a combo box list that has 3 columns and would like to write code the
will allow the user to modify the width of the columns without have to go
into the actual form design. Is this possible and if so how would I go about
writing this?

Thanks
 
The only way to change column widths in a combo would be to use command
buttons for each column to modify the columnwidths property of the columns.
As to allowing users to go into design view. ARRRRGGGGGHHHHHHHH!!!!! You
are buying more headaches that you will want. Users should never have access
to design view and never ever be allowed to work directly in tables.
 
I had no intentions of letting the users modify the actual design, hence the
question. Thanks I will give it a try.
 
Sorry, Dave, but that's not correct. You can diddle with the combo box's
ColumnWidths property.

I just created a form with a 3 column combo box and added some buttons to
it. Initially, the combo box's ColumnWidths property was set to 1";1";1"
(or, since it really uses twips, 1440;1440;1440)

Here's the code I put for the buttons:

Private Sub Command2_Click()
Me.Combo0.ColumnWidths = "720;720;720"
End Sub

Private Sub Command3_Click()
Me.Combo0.ColumnWidths = "1440;0;1440"
End Sub

Clicking on Command2 reset the width of each column to a half-inch each.

Clicking on Command3 reset the width for columns 1 and 3 to an inch, and hid
column 2.

Now, creating an interface to allow them to play with the individual column
widths might be an issue...
 
That is what I said in my previous post, Doug.
"The only way to change column widths in a combo would be to use command
buttons for each column to modify the columnwidths property of the columns."

To do each column, you would have to return the ColumnWidths property.
Maybe use the Split function to break them out and recreate the string to
reset the column widths. Problem might be the total width of the combo's
ListWidth property. That may also have to be recalculated.
 
You're right. Somehow I skipped right over everything between "The only way
to change column widths in a combo would be" and "allowing users to go into
design view".

Sorry about that.
 
No problem, Doug. I can see where allowing users to go into design view
would get your attention <g>
 
Actually, it's your fault. My eye was sort of drawn to the
"ARRRRGGGGGHHHHHHHH!!!!!", regardless how much I wanted to read what
preceded it! <g>
 
I will, in the future, try to control myself, but some things drive me over
the edge. Like allowing users in design mode and people drinking Budwiser
ARRRRGGGGGHHHHHHHH!!!!!
 
Here is a possible solution:
http://www.lebans.com/listboxcolumnresize.htm
ListBoxColumnResize.zip is a Class that allows the user to resize the
ColumnWidths of a ListBox at Runtime.Also supports an Autosizing method for
the ColumnWidths.



Version 2.2 April 27/2002

Modified Columns AutoSizing method to work with both ListBox and Combo
controls.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top