Combo Box Columns Null during On Current event

  • Thread starter mnjkahn via AccessMonster.com
  • 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?
 
S

strive4peace

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
*
 
M

mnjkahn via AccessMonster.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?
 
S

strive4peace

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?
 

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

Similar Threads


Top