Text Box Value > 32768

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using VBA to populate values in a text box ona form in Access. I get a overflow error 6 when I try to assign the value to a formula whose result is greater than 32768. However, hard-coding the value works fine. For example:

me.textbox1.value=40000 ' This works fine

n = 4
me.textbox1.value=n*10000 ' This gives an overflow error 6

Any ideas to make the second code section work?

Thanks
 
Alternative, make the constant 10000 a long by using
me.textbox1.value=n*10000&


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Steve Schapel said:
George,

Presumably n has been declared as an Integer. Change it to Long.
get a overflow error 6 when I try to assign the value to a formula whose
result is greater than 32768. However, hard-coding the value works fine.
For example:
 
Thanks for the tip. I did not expect that the "integer"
property would be inherited by the textbox. I was
looking for a way to set its data type independently from
the other variables.

-----Original Message-----
George,

Presumably n has been declared as an Integer. Change it to Long.
form in Access. I get a overflow error 6 when I try to
assign the value to a formula whose result is greater
than 32768. However, hard-coding the value works fine.
For example:
 
Back
Top