Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Thu, 3 Mar 2005 14:05:23 -0500,    group: microsoft.public.word.word6-7macros        back       


How to run long SQL query in VBA/Word (1400 bytes)   
I need run all big query - the string is 1400 bytes - in VBA to fetch some 
data from a MySQL database into a Word doc.  I need suggestions for a 
different approach, I think.

I've been using
            ActiveDocument.MailMerge.OpenDataSource _
                   Name:="",
                   Connection:="DSN=Connector/ODBC;PWD=;", _
                   SQLStatement:=MyBigSQLQUery,
                   Subtype:=wdMergeSubTypeWord2000

and then manupulating the resulting MailMergeDataSource object myself.  (The 
dataset needs to be massaged before being placed in the MergeFields.)  I 
chose this approach because I, in the best tradition, found a sample I could 
start from.

This works fine for short queries but balks if the query string is greater 
than 255 characters.

Is there a way around this restriction?
What is the implication the the subtype? is there one better suited this 
problem.

The big question: Iis there another way to fetch a ResultSet that need not 
be related to Word (since I handle thedata myself).  I've seen 'ADO' 
mentioned but couldn't find out much about it.  Anything that returns a 
dataset that I can iterate over and manipulate the fields will be fine.

I thank you in advance for your suggestions and help.

Jim Cant

p.s.  Stored procedures on the server are, sadly, not an option.
date: Thu, 3 Mar 2005 14:05:23 -0500   author:   news.rcn.com

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us