K
kenjin
My managed code application invokes Word 2003 automation to provide mailmerge functionality
My mail merge main document contains many (say 100) fields references. Our code generates SQL SELECT statements at runtime to retrieve these field values. The string length of the generated SELECT statements can exceed 1000 characters
According to the Word Visual Basic reference, the OpenDataSource method of the MailMerge object: "... If the query string is longer than 255 characters, SQLStatement specifies the first portion of the string, and SQLStatement1 specifies the second portion." At runtime my code generates an exception that reports the string length exceeds 255 when both SQLStatement (Len = 255) and SQLStatement1 (Len > 255) are provided
My questions are
1) Is the maximum SQLStatement string length that can be passed to this method 510 characters
2) Is there a another way to dynamically establish an ODBC datasource with a long query for MailMerge? (Referencing an MSQuery works well, but my queries must be generated at runtime
Thanks for your help
Ken
My mail merge main document contains many (say 100) fields references. Our code generates SQL SELECT statements at runtime to retrieve these field values. The string length of the generated SELECT statements can exceed 1000 characters
According to the Word Visual Basic reference, the OpenDataSource method of the MailMerge object: "... If the query string is longer than 255 characters, SQLStatement specifies the first portion of the string, and SQLStatement1 specifies the second portion." At runtime my code generates an exception that reports the string length exceeds 255 when both SQLStatement (Len = 255) and SQLStatement1 (Len > 255) are provided
My questions are
1) Is the maximum SQLStatement string length that can be passed to this method 510 characters
2) Is there a another way to dynamically establish an ODBC datasource with a long query for MailMerge? (Referencing an MSQuery works well, but my queries must be generated at runtime
Thanks for your help
Ken