Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004

    Unanswered: Exporting to Word documents and more

    Hello all,

    Basically, I have a basic knowledge of Access and how to get around it. I know little about VB and SQL. On to the question:

    I have created a database in Access that I want to be able to export each record to a seperate Word file, with a letterhead and proper arrangement.

    The closest I can get is to have it fill in a template in Word using Mail merge. However, it puts them all into a 50-some page file that does me no good, since I am not printing them. I need them to be split up, each page as a file, and to be named as the first column in each record.

    If anyone could show me the way or point me to any good resources, I am a quick learner, I would greatly appreciate it.

  2. #2
    Join Date
    Oct 2003
    Here is some code for putting a recordset to several files. The only thing I did not do is change the filename each time. You will have to do so otherwise you willend up with one file with the last record in it.

    Private Type Record
    Counter As String * 300
    Counter2 As String * 2
    End Type


    If rsTemp.RecordCount > 0 Then
    While Not rsTemp.EOF
    Open Filename For Random As #1 Len = Len(MyRecord)
    Lock #1
    MyRecord.Counter = rsTemp!Data1 & Nz(rsTemp!Data2, "")
    MyRecord.Counter2 = vbCr & vbLf
    Put #1, 1, MyRecord
    Unlock #1
    Close #1
    MsgBox "There are no records.", 0, "No Data"
    End If

Posting Permissions

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