Combo box Null value

  • Thread starter Thread starter FBxiii
  • Start date Start date
F

FBxiii

Hi.

I have a combo box that the user selects a value from to populate a
sub-form.

Sometimes, I get an error relating the value of the Combo-box being Null
when it has clearly got a value populated on the form.

How do I get the value of the combo-box selection on the form if
programatically, the value is null?

I hope this makes sens!

Cheers,
Steve.
 
What you see selected in the combo box and what the value of the bound
column is are not necessarily the same thing.

When you simply refer to Me!NameOfComboBox (or
Forms!NameOfForm!NameOfComboBox), you get the value of the bound column. You
can refer to the value of other columns using Me!NameOfComboBox.Column(n),
where n refers to the column number (0 based). In other words,
Me!NameOfComboBox.Column(1) will refer to the value in the second column of
the selected row.
 
Thanks for the reply.

I have trapped the error (2498) and re-assign the Value of the combo-box
like so: cmbSelect_File = cmbSelect_File.Column(0, cmbSelect_File.ListIndex)

It only seems to happen when I switch from Form to Design view then back to
form view. So it should not occur in the Live environment, but its trapped
now just in case :)

Cheers,
Steve.
 
Back
Top