|
-
Mar 14th, 2000, 02:22 AM
#1
How do I? I have two fields in a table, field#1 (2)and field#2 (4)They both have a datatype of text. However when i want to add or substract the values of these two fields together in field#3(data type number) i get an error. How can i get around this problem.
ie.. i get 2 + 4 = 24 I SHOULD GET 2 + 4 = 6
i realize that i can't add two text values together. I would need to convert the text values into numbers.
-
Mar 14th, 2000, 02:30 AM
#2
Hyperactive Member
Use the expression Val or CInt -
total = Val(txtOne) + Val(txtTwo)
-
Mar 14th, 2000, 02:32 AM
#3
Lively Member
try cint(field#1) + cint(field2) = field3
because field1 and field2 are text adding them together is like combining them - thus 2 + 4 = 24, 4 + 2 = 42
-
Mar 14th, 2000, 08:09 AM
#4
Member
Hai,
Since your datatype is text you can not add just like that.
You should convert into interger or double.
so before your calcultation you convert into interger if your values are in the integer limit.use Cint function.
If not simply use Val function.it will converts into double.or use CDbl function.
thanks
karun
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|