Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    18

    Talking Unanswered: Mailmerge-OpenDataSource Problem

    Hi

    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

    With oWord.ActiveDocument.MailMerge


    Call .OpenDataSource(Name:="c:\pay.mdb", _
    LinkToSource:=True, AddToRecentFiles:=False, _
    Connection:="TABLE tClient")

    .Destination = wdSendToNewDocument
    .SuppressBlankLines = True

    Call .Execute(Pause:=True)

    End With

  2. #2
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369

    Re: Mailmerge-OpenDataSource Problem

    not sure about the code/dialog pop-up,

    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?

    D.

  3. #3
    Join Date
    Mar 2004
    Posts
    18
    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
    Attached Thumbnails Attached Thumbnails mailmerge_popup.jpg  

  4. #4
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369
    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.

    Daniel

  5. #5
    Join Date
    Mar 2004
    Posts
    18
    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

    Call .OpenDataSource(Name:="c:\pay.mdb", _
    LinkToSource:=True, AddToRecentFiles:=False, _
    Connection:="TABLE tClient")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •