Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > PC based Database Applications > Microsoft Excel > Excel Forms

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-04-08, 13:05
JezLisle JezLisle is offline
Registered User
 
Join Date: Apr 2007
Location: Stalybridge, Manchester
Posts: 240
Excel Forms

I have a form in Excel that records data, its is an Order Form. On this is a column for Price. I have a number of rows for creating a Description of Goods, Qty & Price. These are all as a Text Box. At the bottom is a Total Box, this is as a Label.

What I am trying to do is after the Text Boxes have had a value input is to calculate the Total Price as we go along. How do I get this to work?

This is what I have been doing....
Code:
Private Sub txtPrice1_AfterUpdate() GetTotal End Sub Private Sub txtPrice2_AfterUpdate() GetTotal End Sub Private Sub txtPrice3_AfterUpdate() GetTotal End Sub Private Sub txtPrice4_AfterUpdate() GetTotal End Sub Private Sub txtPrice5_AfterUpdate() GetTotal End Sub

Code:
Sub GetTotal() TotalPrice.TotalCalc Me.lblTotal = TotalPrice.IngTotalPrice End Sub

Code:
Public IngTotalPrice As Long Public TotalPriceCalc As Long Sub calcTotalPrice() If IsNumeric(usrFrmInputPO.txtPrice1) And IsNumeric(usrFrmInputPO.txtPrice2) And IsNumeric(usrFrmInputPO.txtPrice3) And IsNumeric(usrFrmInputPO.txtPrice4) And IsNumeric(usrFrmInputPO.txtPrice5) Then TotalCalc End If End Sub Sub TotalCalc() IngTotalPrice = usrFrmInputPO.txtPrice1 + usrFrmInputPO.txtPrice2 + usrFrmInputPO.txtPrice3 + usrFrmInputPO.txtPrice4 + usrFrmInputPO.txtPrice5 End Sub

When I use that it tells me that there is a Type Mismatch as example if I've entered 5.00 or anything like a currency value. If I just enter a whole number like 5 then the lblTotal will still not add them up but just keep putting whatever is in the TextBoxes, eg 55555
Reply With Quote
  #2 (permalink)  
Old 06-04-08, 18:54
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,080
Howdy. "Long" only deals with integers. You need to change it to "Single" or "Double".
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 06-05-08, 05:08
JezLisle JezLisle is offline
Registered User
 
Join Date: Apr 2007
Location: Stalybridge, Manchester
Posts: 240
Thanks, I've tried the Single or Double instead of Long and when inputting a Price in the Text Boxes it comes back with Type Mismatch and highlights Sub TotalCalc. I got as far as inputting 2 Price in when the Type Mismatch came up.

What can that be for?

Last edited by JezLisle : 06-05-08 at 11:06.
Reply With Quote
  #4 (permalink)  
Old 06-09-08, 11:46
JezLisle JezLisle is offline
Registered User
 
Join Date: Apr 2007
Location: Stalybridge, Manchester
Posts: 240
I've got a little further with this issue by the help from ExcelForum.com

Trying to understand the CLNG Function, as never come across it before...

http://www.excelforum.com/showthread.php?t=646289
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On