Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Microsoft Access: is it possible to make word docs?

1 Answer

Relevance
  • ?
    Lv 6
    9 years ago
    Favourite answer

    The code below (which I haven't put through its paces) is word for word from http://www.tek-tips.com/viewthread.cfm?qid=1249866

    Sub CreateWordDocument

    Dim wordapp As Word.Application

    Dim STRSQL As String

    Dim Conn as adodb.connection

    Dim RST as adodb.recordset

    Set wordapp = CreateObject("Word.application")

    'Open recordset

    set conn = currentproject.connection

    set RST = new adodb.recordset

    STRSQL = "SELECT * FROM TBLNAME;"

    RSt.open strsql,conn,adOpenForwardOnly ,adLockReadOnly

    'Produce Document

    wordapp.Visible = True

    With wordapp

    .selection.typetext RST!fieldname

    End with

    'tidy up

    set rst = nothing

    Set wordapp = nothing

    end sub

Still have questions? Get answers by asking now.