Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help creating a comparison variable 1

Status
Not open for further replies.

userjf

Technical User
Jun 25, 2004
11
US
I need assistance to create a comparison variable for an MSWord letter merge that will place the correct value in a field after it has evaluated two fields. It is for a tax receipt & the letter details both their gift amount & tax deductible amount if the donor received a premium (gift/dinner/etc):
~~~~~~~~~~~~~
Donor#1
Dinner Purchased
<<Gift Amt>> $160
<<Tax Deductible>> $135
In the above scenario this letter needs to acknowledge the amount of their check ($160) but advise them only $135 is the tax deductible amount

Donor#2
Gift given only
<<Gift Amt>> $200
<<Tax Deductible>> $200
This donor should receive a tax receipt of $200.
~~~~~~~~~~~~~

The data file contains both types of donors and, to date, I haven't been able to get an IF statement to compare both fields/conditions and place the tallies in each. Please note: 1) I'm using Word2003; 2) I do not know how to work w/code/VBA and have not built a variable successfully.

Any help will be greatly appreciated!
jf
 
userjf,

Don't know if you are still interested in this one, but you might try setting up a lookup table in Excel, then using formulas appropriately for a Word Mail Merge with Excel as your data source. You would input the gift amount, then use an appropriate formula to determine the tax deductible amount. Use these data in your mail merge.

Hope this helps.
 
Hi userjf,

Your datasource has fields for both the 'Gift_Amt' and the 'Tax_Deductible' so, if I understand the problem correctly, in your mailmerge letter, you need to have sentences along the lines of:
Thankyou for your tax-deductible donation of «Tax Deductible»
or
Thankyou for your donation of «Gift_Amt», of which «Tax_Deductible» is tax-deductible.


You can do this with field coding in the mailmerge letter, without resorting to vba, using text and coding like:
Thankyou for your {IF{MERGEFIELD Gift_Amt}= {MERGEFIELD Tax_Deductible} "tax-deductible donation of {MERGEFIELD Tax_Deductible \# $,0.00}." "donation of {MERGEFIELD Gift_Amt \# $,0.00}, of which {MERGEFIELD Tax_Deductible \# $,0.00} is tax-deductible."}

To create this, use the above text and replace the nested sets of braces (ie '{ }') with field code braces - you do this by selecting the text string (eg 'MERGEFIELD Gift_Amt') and pressing pressing Ctrl-F9, then deleting the corresponding set of text braces. NOTE: Its important to preserve the field code spacing and quote characters indicated above if the formula is to work correctly.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top