Combo Box Columns Null during On Current event

  • Thread starter Thread starter mnjkahn via AccessMonster.com
  • Start date Start date
M

mnjkahn via AccessMonster.com

I've got a form with several combo boxes on it. During the On Current event,
I successfully reference other columns of the combo boxes beside the bound
column using .Column(Index). I have one combo box which displays the bound
value from the underlying current record, but returns a Null when I try to
reference the control's columns.

Its a 4 column combo box, with the first column bound to the field. The
widths of the columns are 0";5";0";0". I'm testing a value in column 3
(index of 2), and I get error 94, invalid use of null, everytime I test it.
Doing a debug.print on the box itself returns the value, but all the
individual columns, including column(0), return null. Other similar combo
boxes on the page have been working correctly, and still are.

Any ideas?
 
try

iif(isnull(combo_controlname),"",nz(combo_controlname.column(2),""))


until the code works right, you may want to show all the columns so you
can see what the form thinks they are

if column(0) returns null...perhaps you need to check the data type of
the bound field and the first column of the RowSource -- and make sure
the bound field has a value

is there criteria for this combobox? If so, what is it?

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Crystal,

Thanks for pointing me in the right direction. It turns out that the
specific field I was using to provide the criteria was referring to a record
that had been deleted (although it shouldn't have been). I added a test for
a null column value to address the problem, and added referential integrity
to the tables to insure this doesn't happen again.
try

iif(isnull(combo_controlname),"",nz(combo_controlname.column(2),""))

until the code works right, you may want to show all the columns so you
can see what the form thinks they are

if column(0) returns null...perhaps you need to check the data type of
the bound field and the first column of the RowSource -- and make sure
the bound field has a value

is there criteria for this combobox? If so, what is it?

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
I've got a form with several combo boxes on it. During the On Current event,
I successfully reference other columns of the combo boxes beside the bound
[quoted text clipped - 10 lines]
Any ideas?
 
you're welcome ;) happy to help

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


Crystal,

Thanks for pointing me in the right direction. It turns out that the
specific field I was using to provide the criteria was referring to a record
that had been deleted (although it shouldn't have been). I added a test for
a null column value to address the problem, and added referential integrity
to the tables to insure this doesn't happen again.
try

iif(isnull(combo_controlname),"",nz(combo_controlname.column(2),""))

until the code works right, you may want to show all the columns so you
can see what the form thinks they are

if column(0) returns null...perhaps you need to check the data type of
the bound field and the first column of the RowSource -- and make sure
the bound field has a value

is there criteria for this combobox? If so, what is it?

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
I've got a form with several combo boxes on it. During the On Current event,
I successfully reference other columns of the combo boxes beside the bound
[quoted text clipped - 10 lines]
Any ideas?
 
Back
Top