PC Review


Reply
Thread Tools Rate Thread

Access record to Word document

 
 
=?Utf-8?B?TVNVIFNwdG4y?=
Guest
Posts: n/a
 
      28th Feb 2006
I am using the following code in access to merge an access record into the
bookmarks of a word document:

Dim objWord As word.Application
Dim JobHolder As String
Set objWord = CreateObject("Word.Application")
With objWord
.Visible = True
.Documents.Open ("Z:\ODDForms2.doc")

.ActiveDocument.Bookmarks("PIC").Select
If [Form_ODDAPP FORM].PIC <> "" Then
.Selection.Text = (CStr([Form_ODDAPP FORM].PIC))
Else
.Selection.Text = (CStr(""))
End If

.ActiveDocument.Bookmarks("Risk").Select
If [Form_ODDAPP FORM].[Risk No] <> "" Then
.Selection.Text = (CStr([Form_ODDAPP FORM].[Risk No]))
Else
.Selection.Text = (CStr(""))
End If

End With

As soon as Word opens, Access crashes. Any ideas?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
run mail merge to word from ms access using and save every record as separate word document Rasta Microsoft Access 0 12th Dec 2007 11:22 PM
Create Word document from a single Access record =?Utf-8?B?QnJpYW4=?= Microsoft Access External Data 1 28th Feb 2007 09:26 PM
Update word document with one record from Access vba =?Utf-8?B?Tmlsc2VyaWs=?= Microsoft Access Macros 1 3rd Mar 2006 07:29 AM
How do I merge a single record from Access into a Word document? =?Utf-8?B?YWhhd2s=?= Microsoft Access 2 4th Nov 2005 07:39 PM
link word document to access record =?Utf-8?B?ZG91YmxlSg==?= Microsoft Access Forms 0 8th Nov 2004 10:09 PM


Features
 

Advertising
 

Newsgroups
 


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