Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / January 2006

Tip: Looking for answers? Try searching our database.

Invalid Operation with Mail Merge using Split Database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joel' - 27 Jan 2006 18:56 GMT
I have a database that uses mailmerge to generate a transmittal form
and save it as a file.  The functionality worked fine as a standalone
database.  I had to split the database to accomdate three users and now
I get a "Invalid Operations" error when I try to run the merge part of
the program.  Here is what I have behind the button.

Dim db As Database
Dim rst As DAO.Recordset
Dim appWord As Word.Application
Dim ActiveDocument As Object
Dim intCount As Integer
Dim strDocsPath As String
Dim strSaveDocsPath As String
Dim strSQL As String
Dim strTableName As String

Set db = CurrentDb()

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

DoCmd.SetWarnings False

Set rst = db.OpenRecordset("Mergeloans", dbOpenTable)
intCount = DCount("*", "Mergeloans")
If intCount > 0 Then
   vLoanNum = rst.Fields("LoanNumber").Value
   Call MakeF649
End If

Here is the public function:

Dim appWord As Word.Application
Dim objWord As Word.Document
Dim ActiveDocument As Object

Set appWord = CreateObject("Word.Application")
strDocsPath = "C:\Collect\"
strSaveDocsPath = "K:\Archived Collateral Files\"
Set objWord = GetObject(strDocsPath + "SBA649.doc")

With objWord
   .Application.DisplayAlerts = wdAlertsNone
   .Application.Visible = False
   .MailMerge.Destination = wdSendToNewDocument
   .MailMerge.Execute
   .Application.Options.PrintBackground = False
   .Application.ActiveDocument.PrintOut
   .Application.Selection.WholeStory
   .Application.Selection.Fields.Unlink
   .Application.Selection.HomeKey
   .Application.ActiveDocument.SaveAs strSaveDocsPath & vLoanNum & "
SBA649" & Format(Now(), " mmm dd, yyyy ") & ".doc"
   .Application.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
End With

objWord.Close SaveChanges:=wdDoNotSaveChanges

appWord.Application.Quit

Can anyone see anything wrong??  The "K" drive is the local share.  The
new back end is stored in "K:\software\ colateral file room_be.mdb"  I
would really appreciate any help anyone could give me....
Joel' - 27 Jan 2006 19:19 GMT
It seems that I have found the answer.  The use of "dbOpenTable" can
only be used on local tables.  You must use "dbOpenDynaset" for those
databases that are split.  Once I made the change, everything
functioned fine.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.