View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Rich Rich is offline
external usenet poster
 
Posts: 62
Default inserting the DATABASE field in a mailmerge with filtered reul

Hi Peter,

Thanks for your advice, however, when i choose to insert a database field,
all that i see (even after choosing the database) is {DATABASE \*
MERGEFORMAT} I tried changing it to the code you suggested and nothing
changed.

BTW the name of the sheet & spreadsheet is "Retail_SUBMISSION" if that helps
at all

Thanks!



"Peter Jamieson" wrote:

Use Alt-F9 to view the { DATABASE } field code. At the moment it
probably has something like

\s "SELECT * FROM `Sheet1$`"

or some such, near the end. Precisely what is there, and what you can do
with it, depends on the version of Word and how you are connecting to
the sheet.

The basic idea is to add a WHERE clause like this

\s "SELECT * FROM `Sheet1$` WHERE Portfolio_ID = { MERGEFIELD
Portfolio_ID }"

where the {} are the special field code braces that you can insert using
ctrl-F9. That (or something similar) should be OK if the column is
numeric. If Word thinks it's a text column, you would need something
more like

\s "SELECT * FROM `Sheet1$` WHERE Portfolio_ID = '{ MERGEFIELD
Portfolio_ID }'"

It may need a bit more refinement to get it to work, but that's the
starting point anyway.

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

Rich wrote:
I have a Mailmerge document and I want to use the FIELD option (Insert,
Field on the toolbar) to display filtered results from a spreadsheet or
access table.

I am able to insert the DATABASE field but it shows all the rows the
spreasheet( retail.xls). i was wondering if there is a way to filter the
resutls so that ONLY the rows that have the same value as the PORTFILIO_ID
wordfield are displayed.

Any advice or info would be greatly appreciated