Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2005
    Posts
    46

    Unanswered: Access query in word

    Is it possible for a word document to grab data from several queries in a database??

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Yes its possible

    But you have to do it in VBA
    Add-in Access component
    and manipulate it with vba
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

  3. #3
    Join Date
    Feb 2007
    Posts
    15
    Hello there,

    Yes, if you already have the queries in access you can use them as data source in your mail merge document.

    HTH,

    OS

  4. #4
    Join Date
    Feb 2005
    Posts
    46
    Ok
    I have a query (qry4word) that grabs all the fields from table_job where job_ref = getJobNumber() ---this is a function in a module

    If the DB is open and I run the query it gets the records so I need to know how to pass this to word

  5. #5
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    What do you ...

    want to do a mailmerge ?

    or disply the result as a table in Word?
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

  6. #6
    Join Date
    Feb 2007
    Posts
    15
    Ok, let's rock

    * Open your word document
    * Go to tools menu and choose mail merge command
    * On the dialog box that shows up choose the type of document you are about to create - letters, labels, envelopes, etc.
    * As your actual word document will link with your query, you will say that the document is in the current window
    * Now on step 2 you will get your data
    * As you already have an access file with a query you need to display the data you want you will tell word to open data source
    * Now you tell the type of your data source is access and choose the access file we are talking about
    * Now click on the queries tab and select the query you want (qry4word - I guess)
    * click on edit main document command button
    * click on insert mail merge field button
    * select the field and place it where you want
    * when you have done press the view data button - the one like this «ABC»

    That's all

    HTH

    OS

  7. #7
    Join Date
    Feb 2005
    Posts
    46
    I will give it a go later, I tried something like this earlier but it gave me an error saying unknown function getJobNumber().

    I presume this is because its in a module called myModule can you share modules between the two??

  8. #8
    Join Date
    Feb 2005
    Posts
    46
    This is the error I get:

    Error! Cannot open data source.

    If I change the query so it says

    jobRef = 10
    It works

Posting Permissions

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