Forms

J

Jim H

I need help making one field subtract from another field
and give a total. The formula must be written in Java
Script and I'm sure it's a simple task, I just don't kwow
how to do it.

The fields are required for a reimbursement form that I'm
making. The data will be inputed into the fields and the
fields are named as follows:

stmile - endmile = totmile

Thank you in advance!
 
R

Rick

If TOTMILE is a text box on your form, just set the control source to:

=Endmile - stmile


This would then show the total miles in the field. Note: your formula
(stmile-endmile) is backwards. If I start with a mileage of 100 on my
odometer and travel until 110, he result would be 10 mile.s

Hope this is what oyu are looking for.

Rick
 
J

Jim H

No, that didn't work either... I'm actually trying to
subtract a field in an adobe acrobat file.

Adobe is easy to program to "ADD" but it doesn't have
a "subtract" function, except to enter it as a JAVA
SCRIPT. When I try do it the way "excel" would I get
a "syntax error".
 
J

Jim H

It took me awhile, but I found the answer. To program
Adobe Acrobat to subtract use this formula:


// Get field values
var v1 = getField("end_miles").value;
var v2 = getField("start_miles").value;
// Perform subtraction
event.value = v1 - v2;

This assumes you have fields names start_miles & end_miles

Why adobe didn't include a subtraction formula is beyond
me. Enter this under the calculate tab in the "custom
calculation script".
 
C

Chris

The reason that you didn't get an answer from us is that
this newsgroup is for Microsoft Access, not Adobe. I
haven't programmed inside Adobe, so couldn't help.

Perhaps for your next question, you search for a more
appropriate newsgroup.


Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top