View Full Version : Change combobox ColumnCount using VBA


batwings
03-01-2008, 10:08 PM
Hi there

Is it possible to change the ColumnCount of a combobox using VBA?
I want to have the Filter2 combobox listed below to use the column to it's right to give me the "Description" of the Item that is selected in the Filter2 and then this text will be output to my report as below...

Reports![rptFilterDetail].txtReportTitle.Value = _
"System: " & Me.Filter1.Value _
& vbCrLf & "Subsystem: " & Me.Filter2.Value _
& vbCrLf & "Description: " & Me.Filter2.Value

Many thanks
Batwings

CyberLynx
03-02-2008, 01:10 AM
It depends upon what Column the Description data resides in (within the ComboBox).

Lets assume that there are only two Columns of data within the Filter2 ComboBox and bothl columns are visible (Column Widths property: 1";1").

That means then that Column 0 would be the Subsystem data and Column 1 would be the Description data

Reports![rptFilterDetail].txtReportTitle.Value = _
"System: " & Me.Filter1.Value _
& vbCrLf & "Subsystem: " & Me.Filter2.Column(0) _
& vbCrLf & "Description: " & Me.Filter2.Column(1)

Done Deal...
.

fearoffours
04-15-2008, 03:42 AM
Annoying how column 1 in a property is referred to as Column(0) in the underlying code.

CyberLynx
04-15-2008, 07:19 AM
How true that is but there is a secret reason as to why that is....I can't tell you what that is....because it's a secret :D

.