I am using MailMerge method of Word 2002 document through MSAccess 2002 application as following code but it gives popup for Selecting tables from msaccess database (mailmerge used to extract data from msaccess and put it in word doc) I want to avoid this popup to user . In this code we are using OpenDatasource method where we specify table name still it ask for popup please let me know how to avoid it
Code is follow
but can't you simply connect from the Document using the mail merge function, establishing a permanent connection between the document(template) and the db? That does not bring up a dialog like this. Do you have some specific reasons why you need to use VBA for this?
Thnaks you for comments but i have not coded that program, it is coded by somebody else I am doing migration of it from access 97 to 2002 so need to fix that dialogbox which comes for selection I am attaching Dialog box that comes for more understanding Pls let me know if you can pls help me out
hm. in that listing/dialog; can you see the tClient table referenced in the code?
What about the qryClient query that appears in the listing? Can that be used? I do not know what/if that query does/filters, can you access the tables and queries in the DB to check? Since the code references a TABLE (the t in tClient), then the mailmerge is supposed to receive ALL data in the table, not only a subset, which a query could do.
If you compare the number of records returned in the qryClient wth that of tClient, and they are the same, and all relevant fields are included in the query (and its sorting is appropriate), try to replace the word tClient in the code with qryClient.
Thanks again for valuable reply but Here in dialogbox query and tables both are shown but in image file I sent only query can be seen that why you thought abt queries but I select tClient table from dialogbox only
I have assigned table name in code but still it asks for table or query to select I think there is one mistake in my code or I am missing something Please let me know how to avoid that Popup came for selection of table or query