incorrect null value in combobox

C

Catalin

Hello

I have a combo with 2 columns. Everything is set up corectly (bound column,
no of columns etc). Rowsource is a query which has 2 columns as well.

All goes fine but from time to time, i don't know for what reason, I get the
result me.combo.colum(0) or (1) = Null even though I should have not null
values (the bound query returns not null values, I have checked)

It is intriguing that this does not happen every time and also if I check
the value of my combo with me.combo than it returns the correct result not
null.

Can I get the value of my second column other than me.combo.column(1) ?
Because this value is what I need and I get the incorrect Null value.

Thank you very much for your help,
 
S

Stefan Hoffmann

All goes fine but from time to time, i don't know for what reason, I get the
result me.combo.colum(0) or (1) = Null even though I should have not null
values (the bound query returns not null values, I have checked)
Can you post a concise example?

I think it is simply the fact that no value is selected or the field the
ComboBox is bound to itself is null.


mfG
--> stefan <--
 
C

Catalin

Yes I can copy the code but there will be a lot of explanation to do. What
means everything, bla,bla.
Instead I can explain you what is going on, I think is much easier to
understand.

So I have a combo with 2 columns storing the name of one item and unit
weight, a text box storing the no of items and a text box which stores a
calculated value between the unit weight and total items no.

Everything works fine when I enter the data for the first time. But when I
try to edit and modify an existing record by changing the qty I find out that
the column property of the combo returns Null. Pls note thet I do not touch
the combo. Just other fields in the same record. Everything comes to normal
if I enter the combo and then get out. It seems that this requeries the combo
and brings back the data.

I tried including me.combo.requery in my codes but with no success unless I
go in and out of the combo.

Anyway I think that this is not a normal behaviour of Access.




ruralguy via AccessMonster.com said:
Can you post the SQL for the RowSource of the cbo?
Sorry I forgot to tell you that I use ACC 2003 and OS XP proffesional.

Catalin
[quoted text clipped - 13 lines]
Thank you very much for your help,

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com


.
 
M

Maurice

Catalin,

To see if it is the combobox that is bothering you, you could try to reset
the source of the combo when you edit the the records. If that works you know
somethings wrong with the combo.

So try something like: (in a afterupdate of the data or instead of the
requery)

me.combo.rowsource=""
me.combo.rowsource="yourquery"

where combo is the name of your combo and the "yourquery" should be the
queryname of the query you are using for the combo
hth
--
Maurice Ausum


Catalin said:
Yes I can copy the code but there will be a lot of explanation to do. What
means everything, bla,bla.
Instead I can explain you what is going on, I think is much easier to
understand.

So I have a combo with 2 columns storing the name of one item and unit
weight, a text box storing the no of items and a text box which stores a
calculated value between the unit weight and total items no.

Everything works fine when I enter the data for the first time. But when I
try to edit and modify an existing record by changing the qty I find out that
the column property of the combo returns Null. Pls note thet I do not touch
the combo. Just other fields in the same record. Everything comes to normal
if I enter the combo and then get out. It seems that this requeries the combo
and brings back the data.

I tried including me.combo.requery in my codes but with no success unless I
go in and out of the combo.

Anyway I think that this is not a normal behaviour of Access.




ruralguy via AccessMonster.com said:
Can you post the SQL for the RowSource of the cbo?
Sorry I forgot to tell you that I use ACC 2003 and OS XP proffesional.

Catalin

Hello

[quoted text clipped - 13 lines]

Thank you very much for your help,

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com


.
 
C

Catalin

Many thanks for your interest and for your answers. I really appreciate your
help.
It seems that instead of me.combo.requery the proper code is indeed
me.combo.rowsource="myquery...".

That solved my problem allthough I do not know why it occured. The
underlying query runs just fine and I have tested in the query builder many
times.

Anyway, thanks once again,

Regards,


Catalin said:
Yes I can copy the code but there will be a lot of explanation to do. What
means everything, bla,bla.
Instead I can explain you what is going on, I think is much easier to
understand.

So I have a combo with 2 columns storing the name of one item and unit
weight, a text box storing the no of items and a text box which stores a
calculated value between the unit weight and total items no.

Everything works fine when I enter the data for the first time. But when I
try to edit and modify an existing record by changing the qty I find out that
the column property of the combo returns Null. Pls note thet I do not touch
the combo. Just other fields in the same record. Everything comes to normal
if I enter the combo and then get out. It seems that this requeries the combo
and brings back the data.

I tried including me.combo.requery in my codes but with no success unless I
go in and out of the combo.

Anyway I think that this is not a normal behaviour of Access.




ruralguy via AccessMonster.com said:
Can you post the SQL for the RowSource of the cbo?
Sorry I forgot to tell you that I use ACC 2003 and OS XP proffesional.

Catalin

Hello

[quoted text clipped - 13 lines]

Thank you very much for your help,

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com


.
 

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