Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-01-2002, 01:50 PM   #1
meandmyhorse
Junior Member
 
Join Date: Jul 2002
Location: USA
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
meandmyhorse
Compile Error - Expected Expression

I'm still trying to figure out this mail merge stuff. I have been trying the many samples from this board and listed in MS Knowledgebase.

I keep getting a compile error when I type the following code (listed right off Knowledgebase)

Dim objWord As Word.Document
Set objWord = GetObject("d:\data\independent contract.doc", "Word. Document")
'Make Word Visible
objWord.Application.Visible = True
'Set the mail merge data source
objWord.MailMerge.OpenDataSource Name:="C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" & "d:\data\access\temp.mdb"
LinkToSource:=True, Connection:="QUERY qryIndependent"

It hightlights the := next to LinkToSource and Connection and gives me the compile error.

I doubled check that I am using the right programs referenced in the document (Access 97 and Word 97) and that Microsoft Access 8.0 Object Library is checked.

What gives? I see the LinkToSource:= in many of the other samples posted out on the board.

Aargh. The trouble us entry level users get into.

meandmyhorse is offline   Reply With Quote
Old 08-01-2002, 06:26 PM   #2
Tim K.
Registered User
 
Join Date: Aug 2002
Location: Thailand
Posts: 242
Thanks: 0
Thanked 1 Time in 1 Post
Tim K.
The line of code below has to be on ONE line and , need as well.

objWord.MailMerge.OpenDataSource Name:="C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" & "d:\data\access\temp.mdb", _
LinkToSource:=True, Connection:="QUERY qryIndependent"


Sorry if it is.

Last edited by Tim K.; 08-01-2002 at 06:32 PM.
Tim K. is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 05:04 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World