PC Review


Reply
Thread Tools Rate Thread

How can I add Form Results together?

 
 
Mike
Guest
Posts: n/a
 
      29th Jan 2004
I need to add form results before recording them to my dbase. The problem is
that the '+' symbol does not function as I would expect it to.

DocumentCopies = 55
MailCharge = 5

Subtraction, division and multiplication work:
<% InvoiceTotal = DocumentCopies-Mailcharge %> returns 50
<% InvoiceTotal = DocumentCopies/Mailcharge %> returns 11
<% InvoiceTotal = DocumentCopies*Mailcharge %> returns 275

But
<% InvoiceTotal = DocumentCopies+Mailcharge %> returns 555 (I
expect 60)
does not.

Any suggestions?

Mikeal


 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      29th Jan 2004
I figured it out...

When I set the value of DocumentCopies I did this:
<% DocumentCopies = request.form("DocumentCopies")%>

I need to do this:
<% DocumentCopies = CInt(request.form("DocumentCopies"))%>

Mikeal


"Mike" <mike4532> wrote in message
news:(E-Mail Removed)...
> I need to add form results before recording them to my dbase. The problem

is
> that the '+' symbol does not function as I would expect it to.
>
> DocumentCopies = 55
> MailCharge = 5
>
> Subtraction, division and multiplication work:
> <% InvoiceTotal = DocumentCopies-Mailcharge %> returns 50
> <% InvoiceTotal = DocumentCopies/Mailcharge %> returns 11
> <% InvoiceTotal = DocumentCopies*Mailcharge %> returns 275
>
> But
> <% InvoiceTotal = DocumentCopies+Mailcharge %> returns 555 (I
> expect 60)
> does not.
>
> Any suggestions?
>
> Mikeal
>
>



 
Reply With Quote
 
MD WebsUnlimited.com
Guest
Posts: n/a
 
      29th Jan 2004
Mike,

The + operator is using the default values (string) of the variables and
performing concatenation. Use CSng to convert at least one of the values to
a single, single so that you can use 55.23.


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Need to protect your web pages Page Protector Pro
http://www.websunlimited.com/order/P...ro/pagepro.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible


"Mike" <mike4532> wrote in message
news:(E-Mail Removed)...
> I need to add form results before recording them to my dbase. The problem

is
> that the '+' symbol does not function as I would expect it to.
>
> DocumentCopies = 55
> MailCharge = 5
>
> Subtraction, division and multiplication work:
> <% InvoiceTotal = DocumentCopies-Mailcharge %> returns 50
> <% InvoiceTotal = DocumentCopies/Mailcharge %> returns 11
> <% InvoiceTotal = DocumentCopies*Mailcharge %> returns 275
>
> But
> <% InvoiceTotal = DocumentCopies+Mailcharge %> returns 555 (I
> expect 60)
> does not.
>
> Any suggestions?
>
> Mikeal
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return results from a parameter query using a custom form back into the original form.... daddy.dobie@gmail.com Microsoft Access Queries 10 31st May 2007 06:37 AM
form entry results in results being pulled into the form =?Utf-8?B?VEhFIEJJRyBP?= Microsoft Access Forms 6 28th Mar 2007 05:06 PM
Search Form Results, send results to new page =?Utf-8?B?Q2FwdGFpbiBDYXJs?= Microsoft Frontpage 2 1st Aug 2005 07:13 PM
ASP Database Results and Search Form page displays results upon initial entry =?Utf-8?B?RGF0YWd1cnU=?= Microsoft Frontpage 3 27th Mar 2004 06:16 PM
Email Form Results - formated results =?Utf-8?B?VGltZQ==?= Microsoft Frontpage 1 26th Nov 2003 05:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:09 PM.