Possible bug when trying to add two values

  • Thread starter Thread starter Tim J La Fazia
  • Start date Start date
T

Tim J La Fazia

I have a form with two text boxes (Text1 and Text2) whose format is standard
number. I have a list box with two columns (Value1 and Value2) whose format
is set to standard number in the query expression properties. The format
of these values in the source table is Number-Long Integer.

lets say value1=10 and value2=20

My looks like

me.text1=me.list.column(0,0)
me.text2=me.list.column(1,0)

refresh

me.text1=me.text1+me.text2

text1 should now equal 30 but instead I get 1020

I know it sounds like a format mismatch but I have checked everywhere and
all of them from the table to the list box to the text boxes are number
formats.

Any Ideas?

TIA,
Tim J
 
me.text1=me.text1+me.text2

Try

Me.text1 = Val(Me.Text1) + Val(Me.Text2)

Unbound controls - regardless of format - are treated as text strings.

John W. Vinson[MVP]
 
I beleive you but I have done this many times and never had a problem. I
wonder why?
 
In the rest of my application I am doing things this way and it has been
working fine. Should I expect now that I will have to rewrite my code. And
what about the previous apps I have developed. Will they no longer be
working properly?
 
In the rest of my application I am doing things this way and it has been
working fine. Should I expect now that I will have to rewrite my code. And
what about the previous apps I have developed. Will they no longer be
working properly?

There's very likely SOMETHING different. Are these bound or unbound
controls?
 
Back
Top