Consulting

Results 1 to 9 of 9

Thread: Macro to Run a Mail Merge

  1. #1
    VBAX Newbie
    Joined
    Jun 2004
    Posts
    3
    Location

    Macro to Run a Mail Merge

    Regarding this post:

    http://www.vbaexpress.com/forum/showthread.php?t=314

    Quote Originally Posted by ___
    To open the .doc from a form in the db, I'd use the Follow Hyperlink method in the Onclick event of a button.
    [vba]
    Application.FollowHyperlink "c:\My Documents\mymerge.doc", , True, True
    [/vba]
    HTH
    I've got the same problem. Mine is the following, please help me. I have two tables with seperate id-numbers, after deletions, additions etc. they are not synchronical anymore. So when we do a mailmerge we don't have enough by only filling in the number of the record/or id.

    We really want to have a button in the Access form, which opens the selected .doc in Word and most important of all, the selected RECORD.

    Can you help me?
    Last edited by Anne Troy; 06-22-2004 at 03:54 AM.

  2. #2
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    Quote Originally Posted by Denniz79
    I have two tables with seperate id-numbers, after deletions, additions etc. they are not synchronical anymore.
    If you have two tables whereby their primary keys are synchronised then it suggests that your database design is not normalised meaning that you have a flawed structure.

    Why do you have two "synchronised" primary keys?

  3. #3
    VBAX Newbie
    Joined
    Jun 2004
    Posts
    3
    Location

    Exclamation

    Quote Originally Posted by Abulafia
    If you have two tables whereby their primary keys are synchronised then it suggests that your database design is not normalised meaning that you have a flawed structure.

    Why do you have two "synchronised" primary keys?
    I have a table with customers, with primary the customerID and a table with reservations with as primary ReservationsID. When i delete a reservation, then the autonumber keeps following, as well as the customerID. Understand?

    Can you help me?

  4. #4
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    You need a junction table as you have a many to many relationship that you have not modelled.

    Your junction table should consist of two fields: CustomerID and RerservationsID. Both of these should be of the Number data type. They are both foreign keys and should be related to your Customers and Reservations table by the respective primary key. Now, to keep this unique, these two foreign keys should be selected together in order to create this new table's composite (primary) key.

  5. #5
    VBAX Newbie
    Joined
    Jun 2004
    Posts
    3
    Location

    Exclamation

    Quote Originally Posted by Abulafia
    You need a junction table as you have a many to many relationship that you have not modelled.

    Your junction table should consist of two fields: CustomerID and RerservationsID. Both of these should be of the Number data type. They are both foreign keys and should be related to your Customers and Reservations table by the respective primary key. Now, to keep this unique, these two foreign keys should be selected together in order to create this new table's composite (primary) key.
    Ok, but what is going wrong when i then delete a customer or a reservation?
    This isn't my question, i want to have a button in Access from where it starts up Word and (or when it's already open) open the selected .doc and as i said most important the SELECTED record, so we can check it and e-mail it.

    You know how?

  6. #6
    Site Admin
    The Princess
    VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Hi, guys. I broke this off from the other thread.
    ~Anne Troy

  7. #7
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Denniz: It sounds like we need to *build* a document name from the record information. I assume you don't HAVE a hyperlink already, you want to create one that opens the appropriate record. You'll have to let us know what method you have used for the file names of the Word documents and how they relate (syntax) to your Access database record's field names.

    (I think)
    ~Anne Troy

  8. #8
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    I don't mean to hi-jack this thread, but did anyone figure out how to open the word document and set the parameters from Access?

    I have a application that prints contracts for real estate sales and purchases. The original developer built a report formatted to fit the designs of the Real estate agents based on a query that is built strictly in VBA. There are three tables that are joined; properties, specialProvisions, and amendments for changes to the contract.

    Paragraphs are inserted into the SQL creating a huge problem when it comes to Access's limit of 64k characters. Yes amazingly enough we exceed that more often than not now as simple formatting tags alone that were placed in it take up 36K. Add infinite number of memo fields that store special provision information and then amendments and it builds fast. As a solution, I created a word document that held all the standard phrasing that was independent of the data and have put the mailmerge fields into the document to simply insert the necessary data.

    Now my question is the same as Denniz's. Can I open it from VBA and only open the .doc for the current record in the form? I don't want to open the .doc and make the users search through the MailMerge doc for the ID (which is invisible to them on the form)
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  9. #9
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    Didn't figure out how to do it directly from the query in Access but did some exporting into Excel and set the data source from there like the KB article posted on this site.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

Posting Permissions

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