Combo Box Column

S

Sam

I have a combo box with 5 columns only 1 is visible to the user

I have the following code on change

Mystring1 = Me.Combo1.Column(1)
Mystring2 = Me.Combo1.Column(2)

This does not work and gives a readonly error

Can this Work and if so What is the syntax??

TIA

Sam
 
T

Tom Wickerath

Hi Sam,

Combo box columns are zero-based when referring to them in VBA code. To refer to the first two
fields in the row source, one would use:
Mystring1 = Me.Combo1.Column(0)
Mystring2 = Me.Combo1.Column(1)

Could it be that the third column in your row source is not text?

Tom
______________________________


I have a combo box with 5 columns only 1 is visible to the user

I have the following code on change

Mystring1 = Me.Combo1.Column(1)
Mystring2 = Me.Combo1.Column(2)

This does not work and gives a readonly error

Can this Work and if so What is the syntax??

TIA

Sam
 
T

Tom Wickerath

I just tested my guess about the datatype, but this did not pan out. Can you post the row source
for your combo box?

Tom
__________________________


Hi Sam,

Combo box columns are zero-based when referring to them in VBA code. To refer to the first two
fields in the row source, one would use:
Mystring1 = Me.Combo1.Column(0)
Mystring2 = Me.Combo1.Column(1)

Could it be that the third column in your row source is not text?

Tom
______________________________


I have a combo box with 5 columns only 1 is visible to the user

I have the following code on change

Mystring1 = Me.Combo1.Column(1)
Mystring2 = Me.Combo1.Column(2)

This does not work and gives a readonly error

Can this Work and if so What is the syntax??

TIA

Sam
 
S

Sam

Thanks Tom
I have solved it.

Problem was Mystring1 was not the same
Data Type as Combo1.Column(0)

Regards
Sam


I was refrencing
 
Top