Knowledge Base |

# WD: How to query for ""?"" and ""*"" in Print Merge IF field

Article ID: 110282

Article Last Modified on 1/18/2007

APPLIES TO

- Microsoft Word 97 Standard Edition
- Microsoft Word 95 Standard Edition

This article was previously published under Q110282

## SUMMARY

The "?" and the "*" are wildcard characters in a print merge. If you want to query for a "?" or an "*" in a field, use the following syntax:

{IF "?" = {mergefield} "truetext" "falsetext"}
-or-
{IF "*" = {mergefield} "truetext" "falsetext"}

Reversing the query in the IF statement allows Word to view the "?" and the "*" as literal text, rather than as wildcards.

## MORE INFORMATION

Here is a sample data file:

    Name    Number
    Sue     ?
    Dave    4
    Ashley  43        3

### Question Mark

If the Number field is a "?", print "no number", otherwise print the number.

{IF "?" = {mergefield number} "No number to print" "{mergefield number}"}

Form Letter Example:

    Sue      No Number
    Dave     4
    Ashley   43
    *        3

### Asterisks

If the name is an *, print "No name", otherwise print the name.

{IF "*" = {mergefield name} "No name" "{mergefield name}"}
Sue
Dave
Ashley
No Name

Additional query words: winword 7.0 word95 word7 print merge wrong wild card word97

Keywords: kbfield KB110282