Combo box Null value

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.
 
D

Douglas J. Steele

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.
 
F

FBxiii

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top