Combo Box values

  • Thread starter Thread starter Colin
  • Start date Start date
C

Colin

I have set up a combo box on my form - Column 1 is "Assessment Number" and
Column 2 is "Report type" - I want to use the values from both columns in
vba - e.g

if Assessment Number = 1 and Report type = Full then do something
if Assessment Number = 1 and Report type = Interim then do something
if Assessment Number = 2 and Report type = Full then do something
if Assessment Number = 2 and Report type = Interim then do something

How do I select the different columns in vba? I can manage with just the
bound column - but not more than the one column,

Thanks,

Colin
 
You can get the values in the columns of a multi column combo using the
Column property. They are numbered starting with 0, so although the Bound
Column property says 1, it is Column(0) in the column property. So if
Assessment Number is the first column, you can get it with Column(0).

if Assessment Number = 1 and Report type = Full then do something
would be
If Me.MyCombo.Column(0) = 1 And Me.Column(1) = "Full" Then do something
 
Opps, I just reread the post. You statements are not going to work like you
expect.
If Assessment Number is 1, then report type will always be whatever is in
the same row with Assessment Number 1. If the report type can be different
for the same Assessment number, then Report Type needs to be a different
control.
 
Back
Top