Numerics in form drop down fields

T

TD

I want to create a drop-down list using a form field that has numeric
options that can be used in formula fields. It appears that the values
I enter are treated as text and not numeric. Is there a way to make
the drop-down values numeric so I can use the values to perform
calculations?
 
C

Cindy M.

Hi Td,
I want to create a drop-down list using a form field that has numeric
options that can be used in formula fields. It appears that the values
I enter are treated as text and not numeric. Is there a way to make
the drop-down values numeric so I can use the values to perform
calculations?
No... But then, Word turns everything into text. In any case, Word
should interpret them as numeric.

Can you be more specific about "how" it's not working? Give us an
example?

And very important: which version of Word is involved?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
T

TD

I'm using Word 2000. So here's how it's not working. I have two form
fields, one is a text entry field specified as a numeric field and the
other is a drop-down field. I want to use a formula field to multiply
the two form fields and display the result. For example, a person
using the form would enter 3 in the text entry field, then select
either 5000 or 12000 in the drop down list. The formula field
multiples the two bookmarks for the form fields to display the result.
But when I use a drop down list field, it doesn't work. I then tried
changing the drop down list field to a text entry field specified as
numeric, and then filled in the form with 3 in the first field and
5000 in the second. This time, the formula field displays 15,000 as
expected. So my conclusion was that the values from the drop down list
are not being recognized as numeric values. Any ideas would be
appreciated.
 
G

Gregory K. Maxey

I don't know if this has been answered elsewhere or not. I believe you will
need to run a macro OnExit from your Text and DropDown formfields to set the
value of a third formfield. Something like this:

Sub CalcOnExit()
Dim oFF As FormFields
Set oFF = ActiveDocument.FormFields
oFF("Text2").Result = CSng(oFF("Text1").Result) *
CSng(oFF("DropDown1").Result)
End Sub
 
C

Cindy M.

Hi Td,

Mmm, been a while since I've used Word 2000. I thought it used to work
in that version, but maybe it was even further back...

Anyway, I can get it to work, after a fashion, without having to use a
macro:

1. Somewhere in the document, insert a REF field that references the
name (form field) of the dropdown. This will display that value.

2. Select the entire field and assign it a bookmark.

3. Reference this bookmark in your calculation field.

4. Be sure "Calculate on exit" is activated for all the fields involved
in the calculation.

At this point, you should see the calculation update in the protected
form. Of course, you probably won't want to see that value twice in the
document, so...

I found I had to select the REF field and format it as "white". I tried
with "hidden", but the calculation field doesn't pick it up. You can
position it somewhere where it won't be noticeable, use it somewhere in
place of a space, or format it with a very small font size to make it
even less noticeable.
I'm using Word 2000. So here's how it's not working. I have two form
fields, one is a text entry field specified as a numeric field and the
other is a drop-down field. I want to use a formula field to multiply
the two form fields and display the result. For example, a person
using the form would enter 3 in the text entry field, then select
either 5000 or 12000 in the drop down list. The formula field
multiples the two bookmarks for the form fields to display the result.
But when I use a drop down list field, it doesn't work. I then tried
changing the drop down list field to a text entry field specified as
numeric, and then filled in the form with 3 in the first field and
5000 in the second. This time, the formula field displays 15,000 as
expected. So my conclusion was that the values from the drop down list
are not being recognized as numeric values. Any ideas would be
appreciated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
T

TD

Cindy,

Thanks to you and Gregory for the help. I will try this out tonight
and let you know if it works.
 
G

Gregory K. Maxey

Cindy,

Considered that but didn't consider the small white format. I suppose it
would be acceptable in the majority of cases. Only nuisiance I see is users
that don't use a pure white page background or users that display bookmarks.
 

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