Controlling the size of a listbox with VBA?

shabbaranks

Registered User.
Local time
Today, 16:54
Joined
Oct 17, 2011
Messages
300
Hi guys,

Is it possible to set the size and columns which are displayed using VBA for a list box? I know you can control it in the form properties but I have 1 list box which 2 different queries run their results to and are different column widths dependent.

Hope Im making sense?

Thanks

Shabba!
 
Cool, yeah I sussed it out but forgot to post back - thanks for your efforts though. A couple of things - is anyone else having problems with the forum? Its playing up this end.

Also, trying to dsum a column in the list box. I thought I could do the following:
Code:
       Case "All Employees"
       If sGroupID = "2" Then
             MySQL = "Select * From TimesheetTable WHERE [ProjectRef] LIKE '*" & Me.ProjectRef_txtbox & "*'"
                QDef (MySQL)
        Me.Totalhrs_listbox.RowSourceType = "Table/Query"
        Me.Totalhrs_listbox.ColumnCount = "7"
        Me.Totalhrs_listbox.ColumnWidths = "0cm;2.5cm;4.501cm;1cm;4cm;2cm;4cm;0cm;0cm;0cm;0cm;0cm;0cm"
        Me.Totalhrs_listbox.RowSource = MySQL
        Me.TotalHours_txtbox = DSum(Me.Totalhrs_listbox.Column(3))

But I get the error argument not optional - any ideas?
 

Users who are viewing this thread

Back
Top Bottom