How to Use Wildcards to Perform Selective Print Merge

ID: 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, "D*" (without the quotation marks) represents any group of characters that begins with the letter D, regardless of the length of the string. And, "*D" 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, "*D*" is an invalid selection criteria.

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

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

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 "D", use the following syntax in your print merge main document:
    
          {if {First_Name}="D*" "{First_Name}"} 


  • To select records whose First_Name merge field ends with "D":
          {if {First_Name}="*D" "{First_Name}"} 


  • To selectively merge those records whose First_Name merge field begins with "D" and contain four characters:
    
          {if {First_Name}="D???" "{First_Name}"} 


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 "D" would be found, whereas records whose First_Name merge field contains "d" 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.


REFERENCES

"Microsoft Word for Windows User's Guide," version 2.0, pages 637-644

"Microsoft MS-DOS User's Guide and Reference," version 5.0, pages 73-75

Additional query words: winword2 1.0 1.10a 2.0 word6 wild winword card cards pmh helper conditional

Keywords : kbfield kbmerge
Version : WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c
Platform : WINDOWS
Issue type :


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.