Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ColumnWidth Property 1

Status
Not open for further replies.

geetarman

Technical User
Apr 16, 2002
2
US
I have a list box on a form. There are 2 options: Name and Number. Name is the default. When I select Name I get a two column return and that works great. I select Number and that works great.. except, I need the ColumnWidths of the Number option to be reversed.

Example: Name = 4.0;0.75;0 (which means I have a wide 1st column and a narrow 2nd column.)

For Number I need to reverse this to: 0.75;4.0;0. Whereby I would have a narrow 1st column and a wide 2nd column.

I have searched for SetFieldProperty but have not been able to implement it. Here are my two modules:

Private Sub Sort_AfterUpDate()
If (Sort = 2) Then
lstForm.RowSource = "qry_FormsByNumber"
Else
lstForm.RowSource = "qry_FormsByName"
End If

lstForm.Requery

End Sub

Private Sub CreateNewForm()

Dim FormName, value

FormName = lstForm
If FormName & &quot;a&quot; <> &quot;a&quot; Then
DoCmd.OpenForm lstForm
Else
MsgBox &quot;Choose a Form from the list you wish to create&quot;, 0, &quot;Choose Form&quot;
GoTo Exit_CreateNewForm
End If
CloseMe
Forms(FormName).SetFocus
CurrentFileName = &quot;a&quot;
Forms(FormName).Tag = &quot;a&quot;
Application.MenuBar = &quot;mnu_Application&quot;
DoCmd.Maximize

Exit_CreateNewForm:
End Sub
********************
It would seem to me that the property setting would go after the line: DoCmd.OpenForm lstForm


My ListBox properties are:
ColumnWidth: 4.5&quot;;0.75&quot;;0&quot;
BoundColumn: 3
ColumnHead: No
ColumnCount: 3

It would seem if I had a module with the properties I could do away with the listbox properties.

Any insight would be apprecitated!

Kelly




 
Ref:
Example: Name = 4.0;0.75;0 (which means I have a wide 1st column and a narrow 2nd column.)

For Number I need to reverse this to: 0.75;4.0;0. Whereby I would have a narrow 1st column and a wide 2nd column.


Try:

Me.ListBox.ColumnWidths = &quot;4.0 in;0.75 in&quot;

and

Me.ListBox.ColumnWidths = &quot;0.75 in;4.0 in&quot;

Regards
Rod
 
Rod,
Thank you so much for your insight!
You have made my day!!!
I did exactly what you told me to do.
The module ended up looking like this:

[Private Sub Sort_AfterUpDate()
If (Sort = 2) Then
lstForm.RowSource = &quot;qry_FormsByNumber&quot;
Me.lstForm.ColumnWidths = &quot;0.75 in;4.0 in;0 in&quot;
Else
lstForm.RowSource = &quot;qry_FormsByName&quot;
Me.lstForm.ColumnWidths = &quot;4.0 in;0.75 in;0 in&quot;

End If

lstForm.Requery

End Sub]

Thanks again,

Kelly

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top