Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
With Word 2002, I have no problem using a dbf (level 7) as a dataource for
mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark |
#2
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
From the Tools menu, select Options and then go to the General tab and check
the box for "Confirm File Format on Open". Then when the user attaches the data source, a dialog box should be displayed that will give options for the method by which the connection should be made. Try the various options. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Markus" wrote in message ... With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark |
#3
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
This could be to do with how the "MDAC" (Microsoft Data Access) has been
set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark |
#4
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Thanks Doug,
This was helpful. It told me there was both an ODBC option (dbase file odbc) and OLE option for connecting to the dbf datasource. Only problem is when I pick the odbc dbase option, I still get the message "Unable to open datasource". At least it looks like it is not because there is no odbc driver, but for some reason it will still not open the dbf as a datasource. I am in the process of writing the datasource out to .xls to see if I can get around this problem. But any other suggestions would be appreciated. Thanks again, Mark "Doug Robbins - Word MVP" wrote: From the Tools menu, select Options and then go to the General tab and check the box for "Confirm File Format on Open". Then when the user attaches the data source, a dialog box should be displayed that will give options for the method by which the connection should be made. Try the various options. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Markus" wrote in message ... With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark |
#5
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Peter,
As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . |
#6
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
(I recently had a conversation with another "Markus" on xBase
connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . |
#7
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hi Peter,
Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . |
#8
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Unfortunately I suspect that the problem may be the same when you try to
connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . |
#9
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hi Peter,
Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. 1. First, I tried opening Word in it's own window and setting the datasource for mm to a level 7 dbf table. After the trouble I've been having, I was surprised this worked fine. 2. I close Word, then run a dbase application. The app opens to a menu, and I go no further. 3. Then I open Word in another window and try setting the datasource to a dbf (one not at all related to the dbase app that is still running and the same dbf used in step 1 above), and I get the "Unable to open the datasource." message. I have been told that when XP SP2 was released, an odbc driver was not able to be used with 2 apps at once. Once the driver was used by one app, the second and later apps are unable to use it to open files. This appears to be consistent with the behavior I see in my testing. What I don't understand is that I have another client using Word 03 and XP SP2 that does not display this problem. I wonder if there is some operating system setting I am missing that deals with how the odbc is managed by the OS. Or maybe some setting in Word? Any and all ideas you have on this would be much appreciated, Mark Then I tried opening a dbase app which was not using the same dbf datasource. In fact, the app was running with "Peter Jamieson" wrote: Unfortunately I suspect that the problem may be the same when you try to connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . . |
#10
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Well, after much investigation I have new info. Hope you have some
suggestion as to what is going on. Not really, unfortunately. I've had a look around and seen some of the comments about XP SP2 and ODBC but simply haven't been using that combination myself except for testing stuff from other people. However, since it appears from your research that it may be an issue to do with simultaneous use of the driver by more than one program. Other than calling MS support, I would have to research this further myself. Even the stuff I am about to mention is unfamiliar ground, but I'd probably have a go myself just to see what happens: a. identify precisely which driver is actually being used. You should be able to do that by examining the connection string using your /successful/ connection, and looking for that specific name in the ODBC Administrator's list(s) of DSNs. Next to the DSN name you should see the driver name. b. Still in the ODBC administrator, click the Connection Pooling tab, then locate and select the driver. c. Double-click the driver name and change the setting to "Pool connections to the driver" That might at least have some chance of fixing a situation where the problem is that the ODBC driver cannot make more than one simultaneous connection. Other things you can try a a. Check the Windows event log. Occasionally you can see that applications are logging errors that they do not display to you. b. in ODBC, use the Logging tab to configure ODBC logging and see if you can spot anything at the point where you attempt more than one simultaneous connection. (AFAICR the log is pretty low-level stuff that may not make much sense, but looking at such logs can sometimes reveal something useful). c. ensure that your data files are in "Trusted locations." If they are on network drives, it no longer appears to be enough that the files and shares have the correct permissions - if Windows does not think that they are in a "Trusted Location" or the "local Intranet", it may treat them differently. Personally I would also try to ensure that your Foxpro/dbase applicaiton really is closing everything and is not caching anything. I don't know how I'd go about doing that right now though... Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 15:38, Markus wrote: Hi Peter, Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. 1. First, I tried opening Word in it's own window and setting the datasource for mm to a level 7 dbf table. After the trouble I've been having, I was surprised this worked fine. 2. I close Word, then run a dbase application. The app opens to a menu, and I go no further. 3. Then I open Word in another window and try setting the datasource to a dbf (one not at all related to the dbase app that is still running and the same dbf used in step 1 above), and I get the "Unable to open the datasource." message. I have been told that when XP SP2 was released, an odbc driver was not able to be used with 2 apps at once. Once the driver was used by one app, the second and later apps are unable to use it to open files. This appears to be consistent with the behavior I see in my testing. What I don't understand is that I have another client using Word 03 and XP SP2 that does not display this problem. I wonder if there is some operating system setting I am missing that deals with how the odbc is managed by the OS. Or maybe some setting in Word? Any and all ideas you have on this would be much appreciated, Mark Then I tried opening a dbase app which was not using the same dbf datasource. In fact, the app was running with "Peter Jamieson" wrote: Unfortunately I suspect that the problem may be the same when you try to connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . . |
#11
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
This is most helpful. The specifics you provided especially helps give me a
starting point for more investigation. Sorry, but a little unclear on a couple things. You mention the connection string. When in Word on my machine, I click on open datasource, pick Connect to new datasource.odc, then pick "odbc DSN", then Dbase Files. These screens do not seem to have a specific driver name for the connection string. Is this where you meant when indicating the connection string? However, under Administrative Tools in XP, then under Data Sources odbc, I see only one Dbase driver on my machine. I will try setting the connection pooling when next I am able to contact the client (Wed) on their machine and see if that helps. Many thanks for the details. You've given me a good lead to at least have somewhere to start looking on this. Mark "Peter Jamieson" wrote: Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. Not really, unfortunately. I've had a look around and seen some of the comments about XP SP2 and ODBC but simply haven't been using that combination myself except for testing stuff from other people. However, since it appears from your research that it may be an issue to do with simultaneous use of the driver by more than one program. Other than calling MS support, I would have to research this further myself. Even the stuff I am about to mention is unfamiliar ground, but I'd probably have a go myself just to see what happens: a. identify precisely which driver is actually being used. You should be able to do that by examining the connection string using your /successful/ connection, and looking for that specific name in the ODBC Administrator's list(s) of DSNs. Next to the DSN name you should see the driver name. b. Still in the ODBC administrator, click the Connection Pooling tab, then locate and select the driver. c. Double-click the driver name and change the setting to "Pool connections to the driver" That might at least have some chance of fixing a situation where the problem is that the ODBC driver cannot make more than one simultaneous connection. Other things you can try a a. Check the Windows event log. Occasionally you can see that applications are logging errors that they do not display to you. b. in ODBC, use the Logging tab to configure ODBC logging and see if you can spot anything at the point where you attempt more than one simultaneous connection. (AFAICR the log is pretty low-level stuff that may not make much sense, but looking at such logs can sometimes reveal something useful). c. ensure that your data files are in "Trusted locations." If they are on network drives, it no longer appears to be enough that the files and shares have the correct permissions - if Windows does not think that they are in a "Trusted Location" or the "local Intranet", it may treat them differently. Personally I would also try to ensure that your Foxpro/dbase applicaiton really is closing everything and is not caching anything. I don't know how I'd go about doing that right now though... Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 15:38, Markus wrote: Hi Peter, Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. 1. First, I tried opening Word in it's own window and setting the datasource for mm to a level 7 dbf table. After the trouble I've been having, I was surprised this worked fine. 2. I close Word, then run a dbase application. The app opens to a menu, and I go no further. 3. Then I open Word in another window and try setting the datasource to a dbf (one not at all related to the dbase app that is still running and the same dbf used in step 1 above), and I get the "Unable to open the datasource." message. I have been told that when XP SP2 was released, an odbc driver was not able to be used with 2 apps at once. Once the driver was used by one app, the second and later apps are unable to use it to open files. This appears to be consistent with the behavior I see in my testing. What I don't understand is that I have another client using Word 03 and XP SP2 that does not display this problem. I wonder if there is some operating system setting I am missing that deals with how the odbc is managed by the OS. Or maybe some setting in Word? Any and all ideas you have on this would be much appreciated, Mark Then I tried opening a dbase app which was not using the same dbf datasource. In fact, the app was running with "Peter Jamieson" wrote: Unfortunately I suspect that the problem may be the same when you try to connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . . . |
#12
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Sorry, but a little unclear on a couple things. You mention the
connection string. When in Word on my machine, I click on open datasource, pick Connect to new datasource.odc, then pick "odbc DSN", then Dbase Files. These screens do not seem to have a specific driver name for the connection string. Is this where you meant when indicating the connection string? In this case, "Dbase Files" would be the name of the DSN. I suspect it actually says "dBASE Files" if it is the same predefined DSN as I have here. But before you go much further, I hadn't realised you were taking that particular approach to making the connection, and AFAIK the consequence is likely to be that you will be opening your data source, using the "OLE DB Provider for ODBC data sources" which is an approach I know little about (primarily because I could never get it to work) but will try to have a look at. Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 17:45, Markus wrote: This is most helpful. The specifics you provided especially helps give me a starting point for more investigation. Sorry, but a little unclear on a couple things. You mention the connection string. When in Word on my machine, I click on open datasource, pick Connect to new datasource.odc, then pick "odbc DSN", then Dbase Files. These screens do not seem to have a specific driver name for the connection string. Is this where you meant when indicating the connection string? However, under Administrative Tools in XP, then under Data Sources odbc, I see only one Dbase driver on my machine. I will try setting the connection pooling when next I am able to contact the client (Wed) on their machine and see if that helps. Many thanks for the details. You've given me a good lead to at least have somewhere to start looking on this. Mark "Peter Jamieson" wrote: Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. Not really, unfortunately. I've had a look around and seen some of the comments about XP SP2 and ODBC but simply haven't been using that combination myself except for testing stuff from other people. However, since it appears from your research that it may be an issue to do with simultaneous use of the driver by more than one program. Other than calling MS support, I would have to research this further myself. Even the stuff I am about to mention is unfamiliar ground, but I'd probably have a go myself just to see what happens: a. identify precisely which driver is actually being used. You should be able to do that by examining the connection string using your /successful/ connection, and looking for that specific name in the ODBC Administrator's list(s) of DSNs. Next to the DSN name you should see the driver name. b. Still in the ODBC administrator, click the Connection Pooling tab, then locate and select the driver. c. Double-click the driver name and change the setting to "Pool connections to the driver" That might at least have some chance of fixing a situation where the problem is that the ODBC driver cannot make more than one simultaneous connection. Other things you can try a a. Check the Windows event log. Occasionally you can see that applications are logging errors that they do not display to you. b. in ODBC, use the Logging tab to configure ODBC logging and see if you can spot anything at the point where you attempt more than one simultaneous connection. (AFAICR the log is pretty low-level stuff that may not make much sense, but looking at such logs can sometimes reveal something useful). c. ensure that your data files are in "Trusted locations." If they are on network drives, it no longer appears to be enough that the files and shares have the correct permissions - if Windows does not think that they are in a "Trusted Location" or the "local Intranet", it may treat them differently. Personally I would also try to ensure that your Foxpro/dbase applicaiton really is closing everything and is not caching anything. I don't know how I'd go about doing that right now though... Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 15:38, Markus wrote: Hi Peter, Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. 1. First, I tried opening Word in it's own window and setting the datasource for mm to a level 7 dbf table. After the trouble I've been having, I was surprised this worked fine. 2. I close Word, then run a dbase application. The app opens to a menu, and I go no further. 3. Then I open Word in another window and try setting the datasource to a dbf (one not at all related to the dbase app that is still running and the same dbf used in step 1 above), and I get the "Unable to open the datasource." message. I have been told that when XP SP2 was released, an odbc driver was not able to be used with 2 apps at once. Once the driver was used by one app, the second and later apps are unable to use it to open files. This appears to be consistent with the behavior I see in my testing. What I don't understand is that I have another client using Word 03 and XP SP2 that does not display this problem. I wonder if there is some operating system setting I am missing that deals with how the odbc is managed by the OS. Or maybe some setting in Word? Any and all ideas you have on this would be much appreciated, Mark Then I tried opening a dbase app which was not using the same dbf datasource. In fact, the app was running with "Peter Jamieson" wrote: Unfortunately I suspect that the problem may be the same when you try to connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . . . |
#13
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Peter,
I hope I am not confusing things here. In my last post, I outlined how I might open a new datasource. However, normally, I *do not* pick the open a new datasource option. Instead, I simply navigate to the folder that holds the dbf file and double click on it. When I open a data source this way, I am guessing it is using the DSN odbc dBase files by default. Mark "Peter Jamieson" wrote: Sorry, but a little unclear on a couple things. You mention the connection string. When in Word on my machine, I click on open datasource, pick Connect to new datasource.odc, then pick "odbc DSN", then Dbase Files. These screens do not seem to have a specific driver name for the connection string. Is this where you meant when indicating the connection string? In this case, "Dbase Files" would be the name of the DSN. I suspect it actually says "dBASE Files" if it is the same predefined DSN as I have here. But before you go much further, I hadn't realised you were taking that particular approach to making the connection, and AFAIK the consequence is likely to be that you will be opening your data source, using the "OLE DB Provider for ODBC data sources" which is an approach I know little about (primarily because I could never get it to work) but will try to have a look at. Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 17:45, Markus wrote: This is most helpful. The specifics you provided especially helps give me a starting point for more investigation. Sorry, but a little unclear on a couple things. You mention the connection string. When in Word on my machine, I click on open datasource, pick Connect to new datasource.odc, then pick "odbc DSN", then Dbase Files. These screens do not seem to have a specific driver name for the connection string. Is this where you meant when indicating the connection string? However, under Administrative Tools in XP, then under Data Sources odbc, I see only one Dbase driver on my machine. I will try setting the connection pooling when next I am able to contact the client (Wed) on their machine and see if that helps. Many thanks for the details. You've given me a good lead to at least have somewhere to start looking on this. Mark "Peter Jamieson" wrote: Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. Not really, unfortunately. I've had a look around and seen some of the comments about XP SP2 and ODBC but simply haven't been using that combination myself except for testing stuff from other people. However, since it appears from your research that it may be an issue to do with simultaneous use of the driver by more than one program. Other than calling MS support, I would have to research this further myself. Even the stuff I am about to mention is unfamiliar ground, but I'd probably have a go myself just to see what happens: a. identify precisely which driver is actually being used. You should be able to do that by examining the connection string using your /successful/ connection, and looking for that specific name in the ODBC Administrator's list(s) of DSNs. Next to the DSN name you should see the driver name. b. Still in the ODBC administrator, click the Connection Pooling tab, then locate and select the driver. c. Double-click the driver name and change the setting to "Pool connections to the driver" That might at least have some chance of fixing a situation where the problem is that the ODBC driver cannot make more than one simultaneous connection. Other things you can try a a. Check the Windows event log. Occasionally you can see that applications are logging errors that they do not display to you. b. in ODBC, use the Logging tab to configure ODBC logging and see if you can spot anything at the point where you attempt more than one simultaneous connection. (AFAICR the log is pretty low-level stuff that may not make much sense, but looking at such logs can sometimes reveal something useful). c. ensure that your data files are in "Trusted locations." If they are on network drives, it no longer appears to be enough that the files and shares have the correct permissions - if Windows does not think that they are in a "Trusted Location" or the "local Intranet", it may treat them differently. Personally I would also try to ensure that your Foxpro/dbase applicaiton really is closing everything and is not caching anything. I don't know how I'd go about doing that right now though... Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 15:38, Markus wrote: Hi Peter, Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. 1. First, I tried opening Word in it's own window and setting the datasource for mm to a level 7 dbf table. After the trouble I've been having, I was surprised this worked fine. 2. I close Word, then run a dbase application. The app opens to a menu, and I go no further. 3. Then I open Word in another window and try setting the datasource to a dbf (one not at all related to the dbase app that is still running and the same dbf used in step 1 above), and I get the "Unable to open the datasource." message. I have been told that when XP SP2 was released, an odbc driver was not able to be used with 2 apps at once. Once the driver was used by one app, the second and later apps are unable to use it to open files. This appears to be consistent with the behavior I see in my testing. What I don't understand is that I have another client using Word 03 and XP SP2 that does not display this problem. I wonder if there is some operating system setting I am missing that deals with how the odbc is managed by the OS. Or maybe some setting in Word? Any and all ideas you have on this would be much appreciated, Mark Then I tried opening a dbase app which was not using the same dbf datasource. In fact, the app was running with "Peter Jamieson" wrote: Unfortunately I suspect that the problem may be the same when you try to connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . . . . |
#14
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Peter,
My client had to postpone the meeting on Wed, but I plan to try out your suggestions maybe this coming week and will get back here. Appreciate the suggestions. Meantime, I have written up an option for clients to use Excel for the merge by writing out the dbf to .xls. I would much rather get it working with dbf, so hoping I can turn up the reason for the problems. Mark "Peter Jamieson" wrote: Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. Not really, unfortunately. I've had a look around and seen some of the comments about XP SP2 and ODBC but simply haven't been using that combination myself except for testing stuff from other people. However, since it appears from your research that it may be an issue to do with simultaneous use of the driver by more than one program. Other than calling MS support, I would have to research this further myself. Even the stuff I am about to mention is unfamiliar ground, but I'd probably have a go myself just to see what happens: a. identify precisely which driver is actually being used. You should be able to do that by examining the connection string using your /successful/ connection, and looking for that specific name in the ODBC Administrator's list(s) of DSNs. Next to the DSN name you should see the driver name. b. Still in the ODBC administrator, click the Connection Pooling tab, then locate and select the driver. c. Double-click the driver name and change the setting to "Pool connections to the driver" That might at least have some chance of fixing a situation where the problem is that the ODBC driver cannot make more than one simultaneous connection. Other things you can try a a. Check the Windows event log. Occasionally you can see that applications are logging errors that they do not display to you. b. in ODBC, use the Logging tab to configure ODBC logging and see if you can spot anything at the point where you attempt more than one simultaneous connection. (AFAICR the log is pretty low-level stuff that may not make much sense, but looking at such logs can sometimes reveal something useful). c. ensure that your data files are in "Trusted locations." If they are on network drives, it no longer appears to be enough that the files and shares have the correct permissions - if Windows does not think that they are in a "Trusted Location" or the "local Intranet", it may treat them differently. Personally I would also try to ensure that your Foxpro/dbase applicaiton really is closing everything and is not caching anything. I don't know how I'd go about doing that right now though... Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 15:38, Markus wrote: Hi Peter, Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. 1. First, I tried opening Word in it's own window and setting the datasource for mm to a level 7 dbf table. After the trouble I've been having, I was surprised this worked fine. 2. I close Word, then run a dbase application. The app opens to a menu, and I go no further. 3. Then I open Word in another window and try setting the datasource to a dbf (one not at all related to the dbase app that is still running and the same dbf used in step 1 above), and I get the "Unable to open the datasource." message. I have been told that when XP SP2 was released, an odbc driver was not able to be used with 2 apps at once. Once the driver was used by one app, the second and later apps are unable to use it to open files. This appears to be consistent with the behavior I see in my testing. What I don't understand is that I have another client using Word 03 and XP SP2 that does not display this problem. I wonder if there is some operating system setting I am missing that deals with how the odbc is managed by the OS. Or maybe some setting in Word? Any and all ideas you have on this would be much appreciated, Mark Then I tried opening a dbase app which was not using the same dbf datasource. In fact, the app was running with "Peter Jamieson" wrote: Unfortunately I suspect that the problem may be the same when you try to connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . . . |
#15
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hi Peter,
Thanks forall this. I tried some of this without success, tho it is hard as I cannot duplicate the problem and must do all testing on the client's machine. I will try more this week hopefully. Meantime, I am simultaneously trying to use an Excel datasource instead (just writing out the dbf to Excel) and am having a bit of a problem there as well (which I posted on this ng today). This is one of those issues that I must get working, but am being stalled at every turn. Thanks again, Mark "Peter Jamieson" wrote: Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. Not really, unfortunately. I've had a look around and seen some of the comments about XP SP2 and ODBC but simply haven't been using that combination myself except for testing stuff from other people. However, since it appears from your research that it may be an issue to do with simultaneous use of the driver by more than one program. Other than calling MS support, I would have to research this further myself. Even the stuff I am about to mention is unfamiliar ground, but I'd probably have a go myself just to see what happens: a. identify precisely which driver is actually being used. You should be able to do that by examining the connection string using your /successful/ connection, and looking for that specific name in the ODBC Administrator's list(s) of DSNs. Next to the DSN name you should see the driver name. b. Still in the ODBC administrator, click the Connection Pooling tab, then locate and select the driver. c. Double-click the driver name and change the setting to "Pool connections to the driver" That might at least have some chance of fixing a situation where the problem is that the ODBC driver cannot make more than one simultaneous connection. Other things you can try a a. Check the Windows event log. Occasionally you can see that applications are logging errors that they do not display to you. b. in ODBC, use the Logging tab to configure ODBC logging and see if you can spot anything at the point where you attempt more than one simultaneous connection. (AFAICR the log is pretty low-level stuff that may not make much sense, but looking at such logs can sometimes reveal something useful). c. ensure that your data files are in "Trusted locations." If they are on network drives, it no longer appears to be enough that the files and shares have the correct permissions - if Windows does not think that they are in a "Trusted Location" or the "local Intranet", it may treat them differently. Personally I would also try to ensure that your Foxpro/dbase applicaiton really is closing everything and is not caching anything. I don't know how I'd go about doing that right now though... Peter Jamieson http://tips.pjmsn.me.uk On 14/12/2009 15:38, Markus wrote: Hi Peter, Well, after much investigation I have new info. Hope you have some suggestion as to what is going on. 1. First, I tried opening Word in it's own window and setting the datasource for mm to a level 7 dbf table. After the trouble I've been having, I was surprised this worked fine. 2. I close Word, then run a dbase application. The app opens to a menu, and I go no further. 3. Then I open Word in another window and try setting the datasource to a dbf (one not at all related to the dbase app that is still running and the same dbf used in step 1 above), and I get the "Unable to open the datasource." message. I have been told that when XP SP2 was released, an odbc driver was not able to be used with 2 apps at once. Once the driver was used by one app, the second and later apps are unable to use it to open files. This appears to be consistent with the behavior I see in my testing. What I don't understand is that I have another client using Word 03 and XP SP2 that does not display this problem. I wonder if there is some operating system setting I am missing that deals with how the odbc is managed by the OS. Or maybe some setting in Word? Any and all ideas you have on this would be much appreciated, Mark Then I tried opening a dbase app which was not using the same dbf datasource. In fact, the app was running with "Peter Jamieson" wrote: Unfortunately I suspect that the problem may be the same when you try to connect using the Word User Interface - in other words, you do everything correctly, but Word does not. Internally, Word will try to connect using the method you select (if offered). If you don't specify one, it will probably try OLE DB first, then possibly ODBC. In other words, it may be necessary to use VBA to make the connection anyway. Peter Jamieson http://tips.pjmsn.me.uk On 07/12/2009 14:50, Markus wrote: Hi Peter, Yes, I am same Markus. A little different issue here tho. In this case, I am working with Word 03, and the problem is that I cannot get it to read a dbf as a datasource directly within Word. Since I am using the Word menus to set the datasource, the OLE syntax is not relevant here. Doug's post helped me identify that the client has the odbc dbase driver installed. Yet when I select that driver from within Word, it tells me it cannot load the datasource. The dbf file is not corrupted, and I cannot figure what other reason it has for not loading it, other than it is dbf level 7 format. I will be trying more tests later today. BTW, I tried dfferent syntax as you suggested on the previous problem I had (using OLE to set the datasource for Word 07). Was not successful, but I will return to it once I can get this client with Word 03 working. Thanks again, Mark "Peter Jamieson" wrote: (I recently had a conversation with another "Markus" on xBase connectivity and wondered for a moment if you were the same one). I wont be around for a couple of days, but a. you may need to connect using VBA. b. here's one of the messages I posted to him. If you use Google Groups to look up "Peter Jamieson dBase" you may find other relevant info. ---------------------- I believe what is happening in this case is that a. Word is trying to connect using the OLE DB provider b. it either fails because that provider is not present or because the table name is in the wrong format for the provider. The ODBC dirver expects something like Select * from MM.dbf (this is what Word generates when you try to connect manually using ODBC) but the OLE DB provider expects something more like Select * FROM [MM] or Select * FROM `MM` However, both the OLE DB provider and ODBC driver that I have here (as it happens, it's the ACE provider/driver) accept any of Select * FROM [MM] Select * FROM `MM` Select * FROM [MM.dbf] Select * FROM `MM.dbf` FWIW the error I see here is "Error has occurred: The Microsoft Access database engine could not find the object 'M.DB'. Make sure the object exists and that you spell its name and the path name correctly." i.e. the first and last characters of the name have been stripped. I believe that Word will do (a) because you are specifying the .dbf pathname in the Name parameter /and not/ specifying a Subtype parameter equal to wdMergeSubtypeWord2000 (i.e. 8). As it happens, I thought Word XP/2003 also did that,but perhaps the behaviour was slightly different, or perhaps it used the OLE DB provider in those versions too, but the unquoted file name worked in those cases. You can probably find out by inspecting ActiveDocument.MailMerge.DataSource.connectString in Word 2003 (I wouldn't try in Word XP - it may still crash if you do that). If the string starts with DSN, it's ODBC; if it starts with Provider, it's OLE DB. Here, I can get Word 2007 to connect using ODBC either by setting Name to "", or by setting it to the pathname of the .dbf /and/ specifying the wdMergeSubtypeWord2000 subtype value. FWIW at one time I think you had to specify wdMergeSubtypeWord2000 in all cases where Name was set to "", but I think an update modified that behaviour. If it doesn't matter whether you use the ODBC provider or the OLE DB driver, you could see if the dBase equivalent of .OpenDataSource _ Name:="C:\wbdb\db3\KUNDNDB3.DBF", _ sqlstatement:="SELECT * FROM [KUNDNDB3]" works on all the versions of Word you support after Word 2000. All the above assumes that you can use the dBASE provider/driver (which is part of Jet/ACE) and that you do not have to use the FoxPro driver/provider, which is a different thing altogether. FWIW the properties of the "dBASE Files" DSN here (Vista 32-bit SP1, Word 2007 SP1) show that it is using the newer ACE driver. Modifying it to use the older Jet driver made no difference to the behaviour of the OpenDataSource code I tried here. ---------------------- Peter Jamieson http://tips.pjmsn.me.uk On 05/12/2009 03:03, Markus wrote: Peter, As I posted to David, it appears that thre are options on this client computer for using an odbc connection to dbase datasource. But am still getting "Unable to open datasource" when I try to manually connect the datasource. Cannot figure why. Any ideas? Thanks, Mark "Peter Jamieson" wrote: This could be to do with how the "MDAC" (Microsoft Data Access) has been set up. Version 2.5 had an ODBC driver for Foxpro, but version 2.6 did not. You could have a look at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx Alternatively, if what you actually need is the VFP OLE DB provider, that is definitely something that has to be installed - see e.g. http://www.microsoft.com/downloads/d...displaylang=en but there are probably still other versions on the downoads site. You can inspect the ODBC setup by going to Control Panel-Administrative Tools (it's listed in the "classic view"-ODBC Administrator. Or have a look at http://support.microsoft.com/kb/301202 Peter Jamieson http://tips.pjmsn.me.uk On 01/12/2009 18:19, Markus wrote: With Word 2002, I have no problem using a dbf (level 7) as a dataource for mailmerge. With Word 2003, a client is getting the message "Unable to open datasource" when they try to set up a datasource for mailmerge using a dbf (but with no reason given). I have received info from other programmers that confirm their version of Word 2003 seems to have no problem with a dbf. Is it possible that the client's install of Word does not include an odbc driver for dbf files? Wouldn't I get a different message in that case? Anyone know where I go in Word 2003 to see if they have an odbc driver set up? Many thanks for any and all ideas on this, Mark . . . . |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Datasource | Mailmerge | |||
Discontinued reading - create ( external ) reading bookmark | New Users | |||
URL as datasource | Mailmerge | |||
Datasource Path | Mailmerge | |||
Mailmerge datasource | Mailmerge |