![]() |
|
|
#1
|
|||
|
|||
|
I am trying to merge data entered on a form with an existing word doc and am running into trouble. My code is:
Function MergeIt() Dim HoldNotice2 As Word.Document Set HoldNotice2 = GetObject("C:\Documents and Settings\kfergus\Desktop\HoldNotice2merge.doc", "Word.Document") HoldNotice2.Application.Visible = True HoldNotice2.MailMerge.OpenDataSource _ Name:="C:\Documents and Settings\kfergus\desktop\hold.mdb ", _ LinkToSource:=True, _ Connection:="TABLE Holdtbl", _ SQLStatement:="SELECT * FROM [Holdtbl]" HoldNotice2.MailMerge.Destination = wdSendToNewDocument HoldNotice2.MailMerge.Execute HoldNotice2.Application.Options.PrintBackground = False HoldNotice2.Application.ActiveDocument.PrintOut HoldNotice2.Close End Function 1/2 the time it works and the other 1/2 I get error messages about the db being unable to open or to be locked. When I debug it's always the same lines that I'm having trouble with, Set HoldNotice2... and HoldNotice2.MailMerge.OpenDataSource ... I verified the location and it's correct. Help, please! :cry: |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| E-mail Reports | Mike Cooper | Reports | 2 | 08-03-2008 10:58 PM |
| Merge Code problems | kfergus | Access | 1 | 06-01-2006 01:36 PM |
| Mail merge | grgerhard | Forms | 0 | 04-25-2006 03:06 PM |
Automatic E-mail
|
Greg2582 | Access | 6 | 01-10-2006 11:36 AM |