Access World Forums

Access World Forums (https://www.access-programmers.co.uk/forums/index.php)
-   Modules & VBA (https://www.access-programmers.co.uk/forums/forumdisplay.php?f=12)
-   -   Compile Error - Expected Expression (https://www.access-programmers.co.uk/forums/showthread.php?t=32395)

meandmyhorse 08-01-2002 01:50 PM

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.

Tim K. 08-01-2002 06:26 PM

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.


All times are GMT -8. The time now is 09:55 PM.

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