Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 29th, 2005, 11:05 AM
khill khill is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 3 khill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 51 sec
Reputation Power: 0
Exclamation Is it possible to add two string values??

I am working on a form with a calculated field and I want to add two string values on the form together.
The two text boxes are unbound and the values are determined by a case select based on the choice of
a combo box. To get a total of the two unbound text boxes I tried adding them together in the third unbound
text box but it is just concatenating the to boxes together.
IE: unboundtextbox1 = 30.00, unboundtextbox2 = 15.00, unboundtextbox3 = [unboundtextbox1]+[unboundtextbox2]. The answer shoud be 45.00 but I am getting 30.0015.00. Any help would be GREATLY appreciated.

Reply With Quote
  #2  
Old March 29th, 2005, 11:37 AM
pmcnamee pmcnamee is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 13 pmcnamee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 12 m 52 sec
Reputation Power: 0
You should first verify that the values are, in fact, numbers.

Then you can cast the values as numbers and add them together successfully.

For example:
Code:
dim dNum1 as double
 dim dNum2 as double
 dim dNum3 as double
  dNum1 = CDbl(unboundtext1.text)
   dNum2 = CDbl(unboundtext2.text)
   dNum3 = dNum1 + dNum2
 unboundtext3.text = dNum3

Reply With Quote
  #3  
Old March 29th, 2005, 12:14 PM
khill khill is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 3 khill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 51 sec
Reputation Power: 0
Red face

Quote:
Originally Posted by pmcnamee
You should first verify that the values are, in fact, numbers.

Then you can cast the values as numbers and add them together successfully.

For example:
Code:
dim dNum1 as double
dim dNum2 as double
dim dNum3 as double
dNum1 = CDbl(unboundtext1.text)
dNum2 = CDbl(unboundtext2.text)
dNum3 = dNum1 + dNum2
unboundtext3.text = dNum3


THANK YOU!!!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Is it possible to add two string values??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT