[RESOLVED] Word was unable to open datasource
I use word automation (WordXP) in my vb6 app
I want to open a datasource for my with MailMerge (i use this for my labels)
VB Code:
Appword.ActiveDocument.mailMerge.openDataSource Name:= FolderName & "\FormInvullen.mdb", SQLStatement:="select * from LayoutTable", ReadOnly:=True
I get error 'Word was unable to open the datasource'
But i know i have the correct Folderpath in FolderName var
and it can find the database FormInvullen.mdb
When i only give the databasename
VB Code:
Appword.ActiveDocument.mailMerge.openDataSource Name:= FolderName & "\FormInvullen.mdb"
then i get a window where i can choose the table (with name LayoutTable) from a list.
I allso tried leaving out the Readonly but now effect, what am i doing wrong it won't axcept my tablename for some reason.
Re: Word was unable to open datasource
Place a breakpoint before it executes it and place a Debug.Print FolderName & "\FormInvullen.mdb" and see if it prints to the immediate window with the correct path.
Re: Word was unable to open datasource
I tried that and Databasename and tablename is correct.
Like i mentioned before he does find my databasename, but he wont accept my tablename i set through the SQLStatement par (although i copied the exact tablename from my access database). I got stuck here
Re: Word was unable to open datasource
Place the entire path in a variable instead of making word concatenate them together.
You also may need to specify the Connection type as either Table tablename or Query queryname.
Re: [RESOLVED] Word was unable to open datasource
So i had to put Table in front of the tablename
Thx for the solution one problem solved, works like a charme
I gladly mark this resolved.