Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Frank A Frugone Frank A Frugone is offline
external usenet poster
 
Posts: 2
Default When I change the querystring to use a different table, thefieldnames don't update

I'm using an OLEDB connection to an excel workbook. The workbook has
two spreadsheets with data. When I use the datasource.querystring
property to change the name of the spreadsheet (table) I'm using, the
fieldnames remain what they were for the first table. How can I get
the fieldnames to update to those of the second table?

I don't have any idea how the process of gathering the field names
works. I put the field names I want in the first row of the table and
it always picks up on the for table I specify in the opendatasource
sql statement.

I suddenly have an idea for a workaround. What if I use a sql
statement in the opendatasource statement like: "SELECT * table1,
table2", and then change the query string to "SELECT * table1
WHERE ..." and after I gathered all the info from table1, change the
querystring to "SELECT * table2 WHERE ..."? Could work. Only problem
is, I was using both SQLStatement, and SQLStatement1 in the
opendatasource statement because my queries can be long and the
querystring property can only be used up to something like 255
characters. Any ideas about that?

Thanks.
 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Table of Contents: Document Not Seeing heading update Brent E Microsoft Word Help 2 June 8th 12 04:53 PM
doc.Mailmerge.datasource.querystring=strSQL; Command Failed: Run-Time error 4198 weisinator Mailmerge 2 February 13th 07 07:01 PM
Mailmerge, querystring and (un)logical SQL (Word 2003) FP Mailmerge 14 June 30th 06 03:33 PM
Mailmerge Querystring Problems hals left Mailmerge 2 August 23rd 05 03:31 PM
Word Mail Merge with QueryString longer than 255 characters Sebastian Martinez Mailmerge 5 February 7th 05 01:13 PM


All times are GMT +1. The time now is 09:27 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"