Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to dBase 1

Status
Not open for further replies.

AlanDI1

Programmer
Apr 20, 2003
56
I am trying to connect to a dBase file, select some data from that file, drop the link and move on with Access processing.

If I try to Link to the file using the regular Access File/Get External Data/Link Tables and select the DBF file I get a message that says "The Microsoft Jet Engine could not find the object <file name>. Make sure the object exists ...." eventhough I have just used the file browser to select it. That occurs if the file name is more than 8 characters. If it is 8 or less it works.

I have VBA code which is passed a full qualified file name and I do the following:

lcPath = loFileStr.getparentfoldername(pcInput)
lcFileName = loFileStr.GetBaseName(pcInput)
Set tdfInput = Outdb.CreateTableDef("INPUT")
' connect for a non-Access file is the path and the TableName is the file name
lcConnect = "dBASE IV;DATABASE=" & lcPath
tdfInput.Connect = lcConnect
tdfInput.SourceTableName = lcFileName
Outdb.TableDefs.Append tdfInput

Which also works as long as the file name is 8 characters or less. Again same results whether I use dBase III, IV or 5.

I have assumed :)-)) the TableName needs to be a DOS format name. So if the file is greater than 8 characters I take left 6 of the name and append "~1" to make it a DOS file name. That works on some machines and not on others. Why you ask, I wish I knew. :)

Does any one know a way to get the real DOS 8 character file name for the above mentioned dbf file? If I do a DIR in a COMMAND Window I get the Windows file name I don't thnik that will help.

Any recommendations would be appreciated.

I should also add that on machines where this process works I can't figure any way to make it fail (like multiple files with the same first 6 characters).

Thanks all
 
That is absoluley wonderful. Those two scripts work.

Thanks a million.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top