PDA

View Full Version : Solved: Calculate values in table using values in different table



K1ng
05-19-2005, 01:09 AM
Hey guys, I'm a newbie to the whole VBA thing an just wondering if you could help.

Im trying to create a word document with a table at the start with user-changable numbers in it. I would also like other tables througout the word document that have calculated values in them using the values in the first table.

Is this possible?

TonyJollans
05-19-2005, 06:10 AM
Hi K1ng,

Welcome to VBAX!

Yes, it is possible but it sounds more like a Word Form than a VBA requirement.

Set up the first table with Form Fields set to Calculate on Exit and wherever you want the user-entered data to be reproduced have other REF fields or calculated Fields (or FormFields).

Ken Puls
05-19-2005, 08:46 AM
Hi K1ng, and welcome to VBAX! :yes

Just an FYI, I've edited your thread title to be more reflective of the question. This does two things:

-Helps attract experts (like Tony) to your question
-Makes the board more searchable for others who have the same issue

Cheers!

K1ng
05-19-2005, 09:08 AM
Hi K1ng, and welcome to VBAX! :yes

Just an FYI, I've edited your thread title to be more reflective of the question. This does two things:

-Helps attract experts (like Tony) to your question
-Makes the board more searchable for others who have the same issue

Cheers!

Ok, thanks. I'll make future titles more descriptive.

K1ng
05-19-2005, 09:12 AM
Set up the first table with Form Fields set to Calculate on Exit and wherever you want the user-entered data to be reproduced have other REF fields or calculated Fields (or FormFields).

I've never really worked with fields and stuff in apps. How do i set up a field so that users can change it?

TonyJollans
05-19-2005, 09:32 AM
Dreamboat has a sample Form on TheOfficeExperts site - http://www.theofficeexperts.com/word.htm#Fill-inForms

That should get you started.

With the Form unlocked, right click on a field to change its properties (and note its (bookmark) name).

To have a field duplicated use Insert > Field, select REF from the list and the field you want from the list which then appears (that's 2K3 - slightly different in 2000 I think).

For a calculation, insert a new form field, change its properties to calculated and enter your formula.

and so on. Play with it and come back with any problems.

MOS MASTER
05-19-2005, 10:58 AM
Hi and Welcome to VBAX! :hi:

Tony's allready explained the best way to go here so I'll try to add some.

To make forms make use of the 'Forms' toolbar (View/Toolbars/Forms)
Insert a formfield by clicking on the appropriate button on the toolbar.

For easy access to the properties of that field Double click on the field.
Use the Lock-icon on the toolbar to protect the document. (Now the fields will work by using the Tab-key to travel)

I've added a little basic example of calculated formfields.

Enjoy! :whistle:

fumei
05-20-2005, 08:10 AM
You can also check out my FAQ on FormFields (http://tek-tips.com/faqs.cfm?fid=5299) on Tek-Tips. There are two parts. The first part (the link above) is a general overview. Part 2 covers a bit of condiotional logic using formfields - which is more of what you are asking about.

MOS MASTER
05-20-2005, 10:48 AM
Hi Gerry,

Good article! :clap:

K1ng
05-21-2005, 02:08 AM
Sorry about the delay guys. Got it fixed now and it works a charm.

I've been on loads of help boards for loads of subjects in the past and this is the first time I've seen a 'Thread Solved' flag. Thats very usefull.

So, thanks very much guys for the help.
Ross

MOS MASTER
05-21-2005, 09:39 AM
Hi, :yes
You're Welcome! :beerchug: