Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Invalid Operation with Mail Merge using Split Database
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.... |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Invalid Operation with Mail Merge using Split Database
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. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word 2003 Mail Merge from Excel spreadsheet database | Mailmerge | |||
Form Letter Mail Merge using field code: {Database} | Mailmerge | |||
Include Cc: details on merged letters using mail merge database or fields? (not email Cc:) | Mailmerge | |||
Mail Merge - Parameter prompts twice... | Mailmerge | |||
mail merge with attachments | Mailmerge |