Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Joel'
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Joel'
 
Posts: n/a
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2003 Mail Merge from Excel spreadsheet database Cockatiel's mom Mailmerge 1 January 2nd 06 04:44 AM
Form Letter Mail Merge using field code: {Database} jyan Mailmerge 8 December 19th 05 09:18 PM
Include Cc: details on merged letters using mail merge database or fields? (not email Cc:) [email protected] Mailmerge 1 October 7th 05 04:42 AM
Mail Merge - Parameter prompts twice... TL Mailmerge 6 June 17th 05 02:58 PM
mail merge with attachments AS Mailmerge 5 April 9th 05 09:49 AM


All times are GMT +1. The time now is 06:50 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"