Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I am using VB.Net to automate Word 2003 mailmerge; the datasource is a
Microsoft Access database that has a database password. The code works fine on my development computer which has Windows XP Professional (SP2 is not installed) but it does not work on my deployment computer which has Windows 2000, SP4 installed. Both computers have Word 2003 installed. I thought it might be a password problem but I removed the password and am still getting the same error: "Word was unable to open the datasource." Any help that you can provide would be greatly appreciated. Thanks, Sandy |
#2
![]() |
|||
|
|||
![]()
Do you have exactly the same version of Word on both machines? (as in Word
Help|About) Can you post the details (i.e. the code, and the details of what each parameter actually contains when the statement is executed) of your OpenDataSource statement here please? Is the database in the same folder in each case? Is it on the local machine, or on a network path? Could there be a security/permissions issue? Peter Jamieson "Sandra Miller" wrote in message ink.net... I am using VB.Net to automate Word 2003 mailmerge; the datasource is a Microsoft Access database that has a database password. The code works fine on my development computer which has Windows XP Professional (SP2 is not installed) but it does not work on my deployment computer which has Windows 2000, SP4 installed. Both computers have Word 2003 installed. I thought it might be a password problem but I removed the password and am still getting the same error: "Word was unable to open the datasource." Any help that you can provide would be greatly appreciated. Thanks, Sandy |
#3
![]() |
|||
|
|||
![]()
Peter:
Thanks for your suggestions. I finally figured it solved my problem although why the same code did not work on both machines is still a mystery to me. Both machines have the same version of Word, i.e., the same build. Both machines use the same Access database, located in the same local directory so network and security don't seem to be the issue. Originally the database was not password protected so I was using the following code with no problems: ..OpenDataSource(Name:=mstrDataSourceName, LinkToSource:=True, AddToRecentFiles:=False, SQLStatement:=mstrDataSourceSQL.ToString, SQLStatement1:=mstrDataSourceSQL1.ToString) When I added a database password, I change the code to the following: ..OpenDataSource(Connection:=strCnn.ToString, Name:=mstrDataSourceName, LinkToSource:=True, AddToRecentFiles:=False, SQLStatement:=mstrDataSourceSQL.ToString, SQLStatement1:=mstrDataSourceSQL1.ToString, SubType:=Word.WdMergeSubType.wdMergeSubTypeWord200 0) whe strDSN = "DSN=" & IO.Path.GetFileNameWithoutExtension(mclsAsset.IMDb ) strDBQ = ";DBQ=" & IO.Path.Combine(mclsAsset.Directory, mclsAsset.IMDb) strPWD = ";PWD=" & mclsAsset.PWord strCnn = strDSN & strDBQ & strPWD & ";FIL=MS Access" This worked fine on my Windows XP computer but not my Windows 2000. After much trial & error I came up with a strCnn that now works on both machines: strDSN = "DSN=MS Access Database" strDBQ = ";DBQ=" & IO.Path.Combine(mclsAsset.Directory, mclsAsset.IMDb) strPWD = ";PWD=" & mclsAsset.PWord strDbPWD = ";Database Password=" & mclsAsset.PWord strCnn = strDSN & strDBQ & strDbPWD & strPWD & ";FIL=MS Access" Since I had little success finding documentation on what connection string to use when the Access database has a database password, I thought I'd pass along my results. It would be nice to know why a connection string that works on Windows XP doesn't work on Windows 2000. Sandy "Peter Jamieson" wrote: Do you have exactly the same version of Word on both machines? (as in Word Help|About) Can you post the details (i.e. the code, and the details of what each parameter actually contains when the statement is executed) of your OpenDataSource statement here please? Is the database in the same folder in each case? Is it on the local machine, or on a network path? Could there be a security/permissions issue? Peter Jamieson "Sandra Miller" wrote in message ink.net... I am using VB.Net to automate Word 2003 mailmerge; the datasource is a Microsoft Access database that has a database password. The code works fine on my development computer which has Windows XP Professional (SP2 is not installed) but it does not work on my deployment computer which has Windows 2000, SP4 installed. Both computers have Word 2003 installed. I thought it might be a password problem but I removed the password and am still getting the same error: "Word was unable to open the datasource." Any help that you can provide would be greatly appreciated. Thanks, Sandy |
#4
![]() |
|||
|
|||
![]()
The only thing(s) that make sense to me are that either
a. you have a DSN matching "DSN=" & IO.Path.GetFileNameWithoutExtension(mclsAsset.IMDb ) (in essence) on your WinXP box but not on your Win2K box. Typically when you install Office it creates a number of standard ODBC DSN's, but maybe someone created one with the same name as the Access database you are using or b. the DSN constructed using "DSN=" & IO.Path.GetFileNameWithoutExtension(mclsAsset.IMDb ) does not exist. but for some reason the WinXP box behaves differently (could have a different version of MDAC, ODBC or Jet?). However, I would be surprised if that was the case. Peter Jamieson "Sandy" wrote in message ... Peter: Thanks for your suggestions. I finally figured it solved my problem although why the same code did not work on both machines is still a mystery to me. Both machines have the same version of Word, i.e., the same build. Both machines use the same Access database, located in the same local directory so network and security don't seem to be the issue. Originally the database was not password protected so I was using the following code with no problems: .OpenDataSource(Name:=mstrDataSourceName, LinkToSource:=True, AddToRecentFiles:=False, SQLStatement:=mstrDataSourceSQL.ToString, SQLStatement1:=mstrDataSourceSQL1.ToString) When I added a database password, I change the code to the following: .OpenDataSource(Connection:=strCnn.ToString, Name:=mstrDataSourceName, LinkToSource:=True, AddToRecentFiles:=False, SQLStatement:=mstrDataSourceSQL.ToString, SQLStatement1:=mstrDataSourceSQL1.ToString, SubType:=Word.WdMergeSubType.wdMergeSubTypeWord200 0) whe strDSN = "DSN=" & IO.Path.GetFileNameWithoutExtension(mclsAsset.IMDb ) strDBQ = ";DBQ=" & IO.Path.Combine(mclsAsset.Directory, mclsAsset.IMDb) strPWD = ";PWD=" & mclsAsset.PWord strCnn = strDSN & strDBQ & strPWD & ";FIL=MS Access" This worked fine on my Windows XP computer but not my Windows 2000. After much trial & error I came up with a strCnn that now works on both machines: strDSN = "DSN=MS Access Database" strDBQ = ";DBQ=" & IO.Path.Combine(mclsAsset.Directory, mclsAsset.IMDb) strPWD = ";PWD=" & mclsAsset.PWord strDbPWD = ";Database Password=" & mclsAsset.PWord strCnn = strDSN & strDBQ & strDbPWD & strPWD & ";FIL=MS Access" Since I had little success finding documentation on what connection string to use when the Access database has a database password, I thought I'd pass along my results. It would be nice to know why a connection string that works on Windows XP doesn't work on Windows 2000. Sandy "Peter Jamieson" wrote: Do you have exactly the same version of Word on both machines? (as in Word Help|About) Can you post the details (i.e. the code, and the details of what each parameter actually contains when the statement is executed) of your OpenDataSource statement here please? Is the database in the same folder in each case? Is it on the local machine, or on a network path? Could there be a security/permissions issue? Peter Jamieson "Sandra Miller" wrote in message ink.net... I am using VB.Net to automate Word 2003 mailmerge; the datasource is a Microsoft Access database that has a database password. The code works fine on my development computer which has Windows XP Professional (SP2 is not installed) but it does not work on my deployment computer which has Windows 2000, SP4 installed. Both computers have Word 2003 installed. I thought it might be a password problem but I removed the password and am still getting the same error: "Word was unable to open the datasource." Any help that you can provide would be greatly appreciated. Thanks, Sandy |
#5
![]() |
|||
|
|||
![]()
Peter:
I've finally given up trying to figure out the difference. I check my Windows XP machine - no DSN. However, as a test, I went ahead and created a system DSN on the Windows 2000 machine. The original code still didn't work. Go figure. Although I hate these kinds of mysteries, at least I have a workable solution. And it's back to other problems. Thanks for all your help and suggestions. Sandy "Peter Jamieson" wrote in message ... The only thing(s) that make sense to me are that either a. you have a DSN matching "DSN=" & IO.Path.GetFileNameWithoutExtension(mclsAsset.IMDb ) (in essence) on your WinXP box but not on your Win2K box. Typically when you install Office it creates a number of standard ODBC DSN's, but maybe someone created one with the same name as the Access database you are using or b. the DSN constructed using "DSN=" & IO.Path.GetFileNameWithoutExtension(mclsAsset.IMDb ) does not exist. but for some reason the WinXP box behaves differently (could have a different version of MDAC, ODBC or Jet?). However, I would be surprised if that was the case. Peter Jamieson "Sandy" wrote in message ... Peter: Thanks for your suggestions. I finally figured it solved my problem although why the same code did not work on both machines is still a mystery to me. Both machines have the same version of Word, i.e., the same build. Both machines use the same Access database, located in the same local directory so network and security don't seem to be the issue. Originally the database was not password protected so I was using the following code with no problems: .OpenDataSource(Name:=mstrDataSourceName, LinkToSource:=True, AddToRecentFiles:=False, SQLStatement:=mstrDataSourceSQL.ToString, SQLStatement1:=mstrDataSourceSQL1.ToString) When I added a database password, I change the code to the following: .OpenDataSource(Connection:=strCnn.ToString, Name:=mstrDataSourceName, LinkToSource:=True, AddToRecentFiles:=False, SQLStatement:=mstrDataSourceSQL.ToString, SQLStatement1:=mstrDataSourceSQL1.ToString, SubType:=Word.WdMergeSubType.wdMergeSubTypeWord200 0) whe strDSN = "DSN=" & IO.Path.GetFileNameWithoutExtension(mclsAsset.IMDb ) strDBQ = ";DBQ=" & IO.Path.Combine(mclsAsset.Directory, mclsAsset.IMDb) strPWD = ";PWD=" & mclsAsset.PWord strCnn = strDSN & strDBQ & strPWD & ";FIL=MS Access" This worked fine on my Windows XP computer but not my Windows 2000. After much trial & error I came up with a strCnn that now works on both machines: strDSN = "DSN=MS Access Database" strDBQ = ";DBQ=" & IO.Path.Combine(mclsAsset.Directory, mclsAsset.IMDb) strPWD = ";PWD=" & mclsAsset.PWord strDbPWD = ";Database Password=" & mclsAsset.PWord strCnn = strDSN & strDBQ & strDbPWD & strPWD & ";FIL=MS Access" Since I had little success finding documentation on what connection string to use when the Access database has a database password, I thought I'd pass along my results. It would be nice to know why a connection string that works on Windows XP doesn't work on Windows 2000. Sandy "Peter Jamieson" wrote: Do you have exactly the same version of Word on both machines? (as in Word Help|About) Can you post the details (i.e. the code, and the details of what each parameter actually contains when the statement is executed) of your OpenDataSource statement here please? Is the database in the same folder in each case? Is it on the local machine, or on a network path? Could there be a security/permissions issue? Peter Jamieson "Sandra Miller" wrote in message ink.net... I am using VB.Net to automate Word 2003 mailmerge; the datasource is a Microsoft Access database that has a database password. The code works fine on my development computer which has Windows XP Professional (SP2 is not installed) but it does not work on my deployment computer which has Windows 2000, SP4 installed. Both computers have Word 2003 installed. I thought it might be a password problem but I removed the password and am still getting the same error: "Word was unable to open the datasource." Any help that you can provide would be greatly appreciated. Thanks, Sandy |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I get all my Word documents within one Word window | Microsoft Word Help | |||
Cannot open Word document in a Windows XP machine. | Microsoft Word Help | |||
How do i open a microsoft office word document in microsoft works | Microsoft Word Help | |||
How do I open a WORD document in windows ME version of Works?? | Microsoft Word Help | |||
cant open mailmerge datasource | Mailmerge |