Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Run-time error: "432" 3

Status
Not open for further replies.

thirty4d

MIS
Feb 1, 2001
61
US
Help! I think I'm stuck:

I was testing a function per Q159328 - ACC: Example: Mail Merge a MS Access 97 Query with Word 97 document.

I keep getting this error: MS Run-time error '5273':

The document name or path is not valid. But I know I have the correct path.

This is my code:

Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("J:\shared\Layout\WorkingFolder\LayoutMaster.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the MACH_4 database.
objWord.MailMerge.OpenDataSource _
Name:="J:\shared\Layout" & _
"WorkingFolder\MACH_4.mdb", _
LinkToSource:=True, _
Connection:="TABLE Layout", _
SQLStatement:="Select * from [Layout]"

' Execute the mail merge.
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute

'The following line must follow the Execute statement because the
'PrintBackground property is available only when a document window is
'active. Without this line of code, the function will end before Word
'can print the merged document.

objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
End Function

Note1: The error was pointing to the lines in bold/italic and the Debug window was displaying the wrong database name.

Note2: Also want to point out that the actual data source is based on 3 parameter query. In case that might make a difference.

Thanks!


 
just a shot in the dark

should there be a slash after Layout in this part of the code?

Name:="J:\shared\Layout" & _
"WorkingFolder\MACH_4.mdb", _


PaulF
 
PaulF:

Thanks for the suggestion but still getting the same error.

 
Don't know what kind of server you have..... but sometimes a Long Name causes problems....try passing the short name for WorkingFolder

PaulF
 
I've ran into similar problems with long names. Most of the time Win NT won't mind the long names, but my 95 just hates them (Our company is reluctant to upgrade any OS so I'm stuck with good ol' 95). I did what PaulF suggested and just changed the filename from Workingfolder\ to workin~1\ ... If you didn't know Short filenames (MS DOS Names) are always 6 cursors plus that annoying ~ sign and a number. If there is a Workingfolders and a workingfolder dir ... the Workin~1 would correspond to the workingfolder dir (alphabetically) and the workin~2 would correspond to workingfolders. I'm sure most of you know that, but just incase anyone who happens to read this doesn't that's how ya do it. Access liked that. -Happen609
Wasting more of your valuable time...
 
PaulF, Happen609 and Databaseguy,

Thank you so much! All your suggestions were very helpful! ......YES!! It Worked!!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top