Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Can't Open Data Source (Query) where criteria is defined by functi
This question relates to the Automation of Word Mail Merge from Access. I
wasn't sure whether to post it here or on the Access Newsgroup. versions: Word 2000, Access 2000, Windows XP Pro. I have a Word Document. It's Datasource is set to a predefined query in an Access DB. The query has criteria which is defined by functions set at realtime. i.e. the 'CaseID' column has 'getCaseID()' in its criteria. This will return an integer which will have the query select a single row of data. This query works correctly within Access and correctly when attempting to 'Edit' the source from Word. What I am attempting to do is automate the mail merge process from Access. This is where the problem shows itself. I can open the Word document but if I try to set the datasource to the Access query I get an error message: "Word cannot open the datasource" and sometimes "Automation Error". If I replace the functions in the query's criteria with "[]" (so the criteria is manually set at runtime), Word opens the datasource successfully and I can execute the mail merge. If I set the criteria with appropriate data, again the mail merge process is successful using automation. So it seems that Word can't open the datasource when directed to do so by automation where the datasource involves function based criteria. I have put a breakpoint on the function and it is clear they are being consulted and are being assigned correctly. Is this a known problem? I see lots of aritcles about parametrised queries but none take into account setting parameters by function. (see kb209976). Is there a workaround? |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Select Table dialog box comes up twice when open data source | Mailmerge | |||
Mailmerge data source in an Access database will not open | Mailmerge | |||
Cannot Find Its Data Source | Mailmerge | |||
Open Data Source Dialog Box | Mailmerge | |||
Merge Data Source path | Mailmerge |