none
How to connect to an xBase DBF table that has a filename > 8 characters RRS feed

  • Question

  • When I connect to a DBF named "Sample_Labels.dbf" I get an error "Word was unable to open the data source" however if I rename the same file from "Sample_Labels.dbf" to just "Labels.dbf" then Word connects just fine.  I am trying to write a program in C# that automates a mail merge however I cannot get word to connect to a DBF that has an underscore in the name even when I do it manually.

    Tuesday, July 15, 2014 2:17 PM

Answers

  • Just in case anyone is having this same issue...

    The answer to get around this 8 character file name limitation is to create a ".ODC" connection file through Word.  Once this .ODC file is created, it can be used to make the connection to the data by simply selecting the .ODC file when prompted to select your data source.  For automation purposes, I am pro-grammatically updating this .ODC file with my file name and path and then passing the .ODC file to Word to open the data source.

    • Marked as answer by RyanMBrown69 Monday, August 4, 2014 8:03 PM
    Monday, August 4, 2014 8:03 PM

All replies

  • Which version of Word/Office/Windows is involved? As I recall, most recent versions of mail merge (Database Connectivity drivers) don't support linking to dBase III any more...

    See also: http://answers.microsoft.com/en-us/office/forum/office_2013_release-customize/word-2013-dbase-mail-merge-click-to-run/4c1236d2-b55a-4819-b0f2-7c3827019244


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, July 15, 2014 4:47 PM
    Moderator
  • I am using Microsoft Word 2007 on a 32 bit version of Windows 7.  I am assuming the file is dBase III because it is an extract from Visual FoxPro.  Looking at the MSDN info for FoxPro it states that it is "FoxBASE+" because it is copied out of a Fox Table using the "TYPE FOXPLUS" command.  If I open the DBF with Excel 2007, it opens without any issues as well.

    After further testing, I have figured out that it isn't the underscore specifically that is the issue.  The issue is actually a limitation of 8 characters for the file name.  This limitation is only true for files of type xBase (DBF) though because when I connect to an XLSX file, there isn't any problem connecting regardless of the file name.

    Tuesday, July 15, 2014 7:31 PM
  • Hi Ryan

    Thank you for sharing the results of your further investigations. May we mark this as "Answered"?

    If you're still concerned about the DOS file format limitation you need to take the discussion to some place that supports the OLE DB connection providers - Word just uses what's been installed on the system and has no control over this...


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 18, 2014 4:46 PM
    Moderator
  • Just in case anyone is having this same issue...

    The answer to get around this 8 character file name limitation is to create a ".ODC" connection file through Word.  Once this .ODC file is created, it can be used to make the connection to the data by simply selecting the .ODC file when prompted to select your data source.  For automation purposes, I am pro-grammatically updating this .ODC file with my file name and path and then passing the .ODC file to Word to open the data source.

    • Marked as answer by RyanMBrown69 Monday, August 4, 2014 8:03 PM
    Monday, August 4, 2014 8:03 PM