|
-
Aug 15th, 2000, 12:48 PM
#1
Thread Starter
New Member
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?
-
Dec 21st, 2000, 09:57 AM
#2
Junior Member
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
-
Dec 21st, 2000, 11:47 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|