|
-
Apr 7th, 2006, 05:07 AM
#1
Thread Starter
Lively Member
[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.
-
Apr 7th, 2006, 09:33 AM
#2
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 8th, 2006, 01:01 AM
#3
Thread Starter
Lively Member
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
-
Apr 8th, 2006, 08:30 AM
#4
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 8th, 2006, 12:16 PM
#5
Thread Starter
Lively Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|