Results 1 to 8 of 8

Thread: [RESOLVED] ms access create and feed a table in ms word

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    586

    Resolved [RESOLVED] ms access create and feed a table in ms word

    I'm sure I've seen this somewhere, but I can't find where now...

    I have an ms access application , and want to create a word document with a table based on a query.

    I know how to add single values, and how to go over a query values, but how do I create a table that is as long as the number of the records in my query and feed its values?

    I can do this very ugly with something like:
    VB Code:
    1. Set qdf = CurrentDb.QueryDefs("query1")
    2.     qdf("my_station_no") = station_no
    3.     Set rs = qdf.OpenRecordset
    4.    
    5.     rs.MoveFirst
    6.      If rs.EOF Then goto bypass  
    7.        MyDoc.variables("Item1") = Nz(rs("item_type_name"), "")
    8.        MyDoc.variables("Amount1") = Nz(rs("ramount"), "")
    9.     rs.MoveNext
    10.     If rs.EOF Then  goto bypass  
    11.    
    12.        MyDoc.variables("Item2") = Nz(rs("item_type_name"), "")
    13.        MyDoc.variables("Amount2") = Nz(rs("ramount"), "")
    14.     rs.MoveNext
    and so on as long as I have records, but needless to say I don't want it this way.

    anyway I can create an array of fields in ms word lined up in a table, or something similar?
    Last edited by Hack; May 15th, 2006 at 01:39 PM. Reason: Added [vbcode] [/vbcode] tags for more clarity.

Posting Permissions

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



Click Here to Expand Forum to Full Width