Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Summing two text boxes on a form - HELP!

Hello,

I have a simple input form, there are 3 boxes which hold numbers. A net cost
is firstlykeyed into a text box called 'tbNet' then if the item is vatable a
'VAT @ 17.5%' checkbox is selected and this calculates 17.5% of the input
disabled text box called 'tbVAT'.

The 3rd text box 'tbGross' needs to add the other two text boxes togethor, I
keyed this bit of code as Private Sub's 'tbGross_Change' and 'tbVAT_Change'
the code I have used is 'frmCashRecd.tbGross.Value = frmCashRecdtbVAT.Value
+ frmCashRecd.tbNet.Value' but rather than sum the two values togethor (i.e.
100 + 17.50 = 120) the value in 'tbGross' is 10017.5 (i.e. it concatenates
the two togethor). Is there a bit of code I can use that will sum instead?

Please help!

Cheers
Brian, Manchester

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Summing two text boxes on a form - HELP!

Brian

A textbox returns a string you therefore need to convert the string to a
number to use them. If they are integers use cint or clng or if reals cdbl
or ccur depending on your preference remebering to apply the rules for the
calculation of VAT and I think it is to round down but I'm not sure. So when
you calc the VAT is should be rounded to two places
rounddown(ccur(me.tbnet.value) * VATRate,2).

Use a constant for the vat rate so that it is easy to change when they
change it.
--
Hope this helps
Martin Fishlock


"Co-op Bank" wrote:

Hello,

I have a simple input form, there are 3 boxes which hold numbers. A net cost
is firstlykeyed into a text box called 'tbNet' then if the item is vatable a
'VAT @ 17.5%' checkbox is selected and this calculates 17.5% of the input
disabled text box called 'tbVAT'.

The 3rd text box 'tbGross' needs to add the other two text boxes togethor, I
keyed this bit of code as Private Sub's 'tbGross_Change' and 'tbVAT_Change'
the code I have used is 'frmCashRecd.tbGross.Value = frmCashRecdtbVAT.Value
+ frmCashRecd.tbNet.Value' but rather than sum the two values togethor (i.e.
100 + 17.50 = 120) the value in 'tbGross' is 10017.5 (i.e. it concatenates
the two togethor). Is there a bit of code I can use that will sum instead?

Please help!

Cheers
Brian, Manchester

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link Text Boxes on Form? Joyce Excel Discussion (Misc queries) 8 September 1st 09 06:20 AM
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
Form, or seperate text boxes? pianoman[_17_] Excel Programming 10 May 24th 06 03:36 PM
Summing the values in text boxes cosmic mo Excel Programming 4 March 17th 06 05:20 PM
How to iterate through all Text Boxes on a Form? Ed Excel Programming 5 February 16th 05 01:24 PM


All times are GMT +1. The time now is 04:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"