Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2003
    Posts
    10

    Unanswered: embed word doc in access report, show diff doc on each page of report

    I am trying to embed/link? a word document in an Access 2000 report. The report prints a different access record on each page and each rep pg/access record has an associated word doc which needs to be printed on that page (need word doc for Word's formatting capabilities), followed by a small subreport lsiting associated records from the database. My problem is, how do i change (using vba in the on format code for the section containing the embedded word doc presumably) the name of the word document which is displayed for each access record. I have found code to do this on a form, but it requires the enabled and locked properties for the ole object to be altered to work, and those properties are not available in a report.

    Any ideas would be most helpful? (Other than reversing the process and using mail merge and drving it from Word which i want to avoid if possible.)

  2. #2
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    set the source of the ole object behind the oncurrent event of a form or the path and name of the file in a table corralating to the record

    then reformat the source of the object where id = reports!reportname!reportid


    meaning you can use dlookup to find the path of the doc where the ID in the table matches the Id (or what ever criteria) on the report

  3. #3
    Join Date
    Jun 2003
    Posts
    10
    Thanks for the reply, but I have no problem obtaining the word doc name. My problem is, what code do I need to change the source for the document in the report TO that document name, and have the right doc print out. Its not a form Im displaying the doc on, its a report, and the only code Ive found so far is for forms, and relies on the control's enabled and locked properties being set, which of course dont exist in a report.

    I may be misinterpreting what youre saying , could you let me know if you think I am.

    Thanks for your help.

  4. #4
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    if you embed a word doc in a report, that object has a data source/path

    on the format event of the group by header you may want to change that path to reflect the correct doc for the page

    If you send a sample db with two of the docs and the pathing structure of the docs I will look at it for you

  5. #5
    Join Date
    Jun 2003
    Posts
    10
    Thnaks a lot for the offer. Ill zip up a small mdb with a report with embedded doc, and 2 docs, and table with the doc name and path in a field, and two records in the table. I have tried chging the doc source in the on format for the section where it is embedded but cant get the code to work. I get an error of some sort whatever Ive tried so far.

    Emaill with zip attchment to follow soon. Thanks very much for your help.

  6. #6
    Join Date
    Jun 2003
    Posts
    10
    Thanks for the help, zip file with small testdb (1 table containing 3 records, and 1 report), and three word docs attached one for each record in table. Table has fields for path and file name for the word doc for each record.

    If you can help thatd be great as I'm stuck at the moment.

    When I run the report with my code to chg the docsource for the ole object to the path and filename required (in the on format event for that section) I get an error and i have tried a whole lot of different versions of coding it and all either do nothing or cause a runtime error.
    Attached Files Attached Files

Posting Permissions

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