Microsoft KB Archive/88679

{|
 * width="100%"|

How to Use Wildcards to Perform Selective Print Merge

 * }

Q88679

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c

-

SUMMARY
In Microsoft Word for Windows, you can use the asterisk (*) and the question mark (?) wildcard characters as part of a selective print merge operation. These wildcards function in Word for Windows similar to the way they function in Microsoft MS-DOS (that is, they act as a substitute for a letter, number, or string).

MORE INFORMATION
The asterisk (*) wildcard character represents a whole word or a group of characters, regardless of length. For example, &quot;D*&quot; (without the quotation marks) represents any group of characters that begins with the letter D, regardless of the length of the string. And, &quot;*D&quot; represents any group of characters that ends with the letter D, regardless of its length.

Note: You cannot search for a string that both begins with an asterisk and ends with an asterisk; therefore, &quot;*D*&quot; is an invalid selection criteria.

The question mark (?) wildcard represents a single character. For example, &quot;?D&quot; represents any string that contains one character before the letter D, such as &quot;ID.&quot; And, &quot;?D?&quot; represents any string with one character before and one character after the letter D, such as &quot;IDE.&quot;

While the asterisk (*) wildcard character can successfully merge data that begins with numbers, the question mark (?) wildcard character cannot. For example, you could use &quot;98*&quot; during a print merge, but not &quot;98???&quot;.

Using Wildcards to Perform Selective Print Merge
Note: In the following samples, create the field braces by pressing CTRL+F9.

  To select records whose First_Name merge field begins with &quot;D&quot;, use the following syntax in your print merge main document:      {if {First_Name}=&quot;D*&quot; &quot;{First_Name}&quot;}   To select records whose First_Name merge field ends with &quot;D&quot;:      {if {First_Name}=&quot;*D&quot; &quot;{First_Name}&quot;}   To selectively merge those records whose First_Name merge field begins with &quot;D&quot; and contain four characters:      {if {First_Name}=&quot;D???&quot; &quot;{First_Name}&quot;} 

Note: In a Word for Windows print merge operation, the characters inside the quotation marks are case sensitive. In the above examples, records whose First_Name merge field contains &quot;D&quot; would be found, whereas records whose First_Name merge field contains &quot;d&quot; would not be found.

For information on using wildcards to perform a selective print merge in which a numeric character follows the wildcard, query on the following words in the Microsoft Knowledge Base:

"numeric and and wildcard and incorrect"

STATUS
Microsoft has confirmed this to be a problem in Word for Windows versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, and 6.0c. This problem was corrected in Word version 7.0 for Windows 95.