Hi All,
I'm still working on that dynamic faxing database. Here is the problem I am having today. I have 2 mail merges controlled by the same database. I reference the object in my declaration by using
Then I call the objects from my cmdButton Code like
Then it runs the function which I have coded as so
The problem comes into play when I get back to the code of the cmdButton. I use:
I need word to "go away" so I can start my next merge. It stays there in the back ground. If I dont hover over my computer with task manager showing and kill off the word application (which is by the way hidden). It messes up the next merge letter. Am I using the wrong kill command. Why won't word unload on the
command?
Please help
Scotty : Become better informed. Lean from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
I'm still working on that dynamic faxing database. Here is the problem I am having today. I have 2 mail merges controlled by the same database. I reference the object in my declaration by using
Code:
Dim objHMOWord As Word.Document
Code:
Set objHMOWord = GetObject ("G:\hcm\common\scott\faxdocs\hmo.doc", "Word.Document")
HMOMergeIt lsName, lrsHMO.Fields(0), "hmoMemb"
Code:
Function HMOMergeIt(lsName As String, lsAutoCounter As Single, lsTableName As String)
Dim lsSQLStatement As String
Dim lsFieldName As String
lsFieldName = "hmomemb.autocounter"
' Create the SQLStatement
lsSQLStatement = "SELECT " & lsTableName & ".*," & lsFieldName & Chr(13) & "FROM " & lsTableName & " " & Chr(13) & "WHERE (((" & lsFieldName & ")=" & lsAutoCounter & "));"
objHMOWord.MailMerge.OpenDataSource _
Name:="g:\hcm\common\priv1\ptc\Nextry.mdb", _
SQLStatement:=lsSQLStatement
' Execute the mail merge.
objHMOWord.MailMerge.Execute
' Save the merged document
objHMOWord.Application.ActiveDocument.SaveAs filename:="G:\hcm\common\scott\faxdocs\" & lsName
' Closing the new doc
objHMOWord.Application.ActiveDocument.Close False
End Function
The problem comes into play when I get back to the code of the cmdButton. I use:
Code:
Set objHMOWord = Nothing
Code:
objHMOWord = Nothing
Please help
Scotty : Become better informed. Lean from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),