Results 1 to 3 of 3

Thread: access database, word mail merge... need i say more? =)

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Canterbury,Kent,UK
    Posts
    8

    Angry

    OK, long and comlicated....

    basically I'm trying to mailmerge a current record to word. I have a query that finds the current record from the key on the form but when i try to mailmerge it word starts a new session of access and then, no surprise, the query prompts for the form field....

    any idea how to get word to use the current session, or any other way of fixing it?

    it occoured to me that i could get the windows userid with an API call and write it vs the table key value in another table... then the key number could be picked up in without the form open... but i think the chances of getting the query to pick up the userid are... well... slim...

    any idea?

  2. #2
    Junior Member
    Join Date
    Dec 2000
    Location
    London
    Posts
    24

    Smile Hope this helps

    I don't know if this will help, it's pretty simplistic, but I had the same sort of problem and the only way I could get around it was transfering the data to an excel spreadsheet file (filetemp1 or whatever - it would be written over if the query data changed) You can then call the excel file and merge it how you like.

    Hope it helps - unfortunately though I'm not so hot at this stuff yet!!

    Sacha.

    Private Sub cmdMMTempQuery_Click()

    Dim objWord As Word.document
    Dim mywdapp As Word.Application
    Dim Filename1 As String

    On Error GoTo Errorhandler

    Set mywdapp = CreateObject("Word.application")
    mywdapp.Application.Visible = True
    Filename1 = InputBox("Please enter document path and filename", "Message")
    mywdapp.Documents.Open Filename1

    Set objWord = mywdapp.ActiveDocument


    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "querywhatever", "c:\tempfile1.xls", False
    objWord.MailMerge.OpenDataSource "C:\tempfile1.xls", , , , , True, , , , , , "querywhatever"

    Exit Sub


  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can make a macro in word to query the data and pass it the id for the current record. Look at this query and see if it helps.

    http://forums.vb-world.net/showthrea...threadid=45096

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