View Single Post
 
Old 04-08-2013, 05:13 AM
JennEx JennEx is offline Windows XP Office 2003
Competent Performer
 
Join Date: May 2010
Posts: 162
JennEx is on a distinguished road
Default

Good day Paul,

Once again, I thank you for your efforts. You've exceeded the 5 star rating for awesomeness.

Anyway ... lets deal with one issue at a time.

Due to the number of different combinations of reports that will have to be prepared, and to keep user from having to do too much, the SQL coding option is the preferred.

I changed my Excel VBA code with what I believe to be the edit you suggested. (green highlighted)

Code:
.OpenDataSource _
              Name:=StrSrc, ReadOnly:=True, AddToRecentFiles:=False, LinkToSource:=False, _
              Connection:="Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;" & _
                "Data Source=StrSrc;Mode=Read;Extended Properties=""HDR=YES;IMEX=1"";", _
                SQLStatement:="SELECT * FROM `CONTROL_1$` where *'Type$'*='DR' and 'SubResp' = 'RPL1'",  _
                SQLStatement1:="", SubType:=wdMergeSubTypeAccess
The code hangs at this statement with no apparent cause. Task Manager reveals Word has opened up a dialogue box ..."SELECT TABLE", and oddly referring to a workbook that doesn't exist. (2013 New.xlsx).

Using the SQL option, is it possible to substitute the 'SubResp' value (currently RPL1) with a variable? This report will be used for several different scenarios based on different SubResp.

Thanks Paul,
Jenn

PS ... Thanks for the macro!!! Saved me a lot of frustration. But, you will concur it won't for fields in the headers or footers? (the next issue once this is solved hehehe)
Reply With Quote