Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
l_stocky
 
Posts: n/a
Default 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

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Table dialog box comes up twice when open data source Paula Jern Mailmerge 0 January 6th 05 05:07 PM
Mailmerge data source in an Access database will not open Colin C Mailmerge 3 December 31st 04 12:01 AM
Cannot Find Its Data Source Dave Foote Mailmerge 3 December 17th 04 11:27 AM
Open Data Source Dialog Box Cindy M -WordMVP- Mailmerge 2 December 7th 04 08:22 PM
Merge Data Source path Peter Jamieson Mailmerge 0 November 25th 04 07:15 PM


All times are GMT +1. The time now is 03:37 AM.

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"