Adding to variable

Results 1 to 3 of 3

Thread: Adding to variable

  1. #1
    Join Date
    Dec 1969

    Default Adding to variable

    I have a to variable from request form .. i am trying to add them<BR>The result i get is combination of the both variables<BR><BR>var1, var2<BR>If var1=3 var2=3<BR><BR>Dim Total<BR>Total = var1 + var2<BR><BR>The result i get is Result = 33 rather than 6. why ???<BR><BR>Also how can I add two fields in MS Access table..<BR><BR>I have 3 field called Var1, Var2, Total<BR><BR>how can i able to add var1, and var2 and store the results in the Total field.<BR><BR>Please help... Thanks in Advance<BR>

  2. #2
    Eddie Campbell Guest

    Default RE: Adding to variable

    It&#039;s because the two variables are being interpreted as text.<BR><BR>Try this<BR>Total = Cint(var1) + Cint(var2)

  3. #3
    Al Bear Guest

    Default Strange..

    What I think is happening is that the ASP thinks your varables are strings and is merging them. try doing...<BR><BR>var1 = 3<BR>var1 = Cint(var1)<BR><BR>var2 = 3<BR>var2 = cint(var2)<BR><BR>total = var1 + var2<BR><BR>thios should ork as you are forcing the varable to be integers...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts