Solved

Copying a DBF file fails

Posted on 2015-01-21
9
268 Views
Last Modified: 2015-02-02
I am working with a .DBF (MyTest.DBF) file which has plenty of records in it. For a new requirement I had to create a copy of the DBF file for a different application and rename it (MyTest_New.DBF).

When I ran a program and inserted records into MyTest_New.DBF, the same records got inserted into MyTest.DBF too. (And vice-versa) I am not sure how these two files are linked.

The program I ran, creates an MS Access database and creates MyTest_New.DBF as a linked table in it and then inserted records into it.

Is there a different way the DBF files should be created a copy of? Please advise.
0
Comment
Question by:Angel02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 18

Expert Comment

by:Simon
ID: 40563760
It sounds like you created an alias (shortcut) from MyTest.DBF rather than a new copy of it. Did you copy a single DBF file to a different folder or create the copy alongside the original in the same folder?

Try googling "BDE DBF alias"  - I am guessing that you might have BDE installed
0
 
LVL 42

Expert Comment

by:pcelba
ID: 40563936
If you are working in MS Access then the "copy" means just the "link copy" but the target remains unchanged.

To copy the MyTest.DBF you have to find its physical location on disk and make a physical copy of the file to another disk location in e.g. Windows Explorer. Then you must create a new link in MS Access.

DBF files can consist of up to three parts:
MyTest.DBF - database table
MyTest.FPT - memo file
MyTest.CDX - index file
you have to copy all of them if they exist.

MS Access should be closed during the copy operation.
0
 

Author Comment

by:Angel02
ID: 40564065
I copied the DBF and pasted in a different folder. Then I renamed it and put it back in the original folder. I need to have both the files MyTest.DBF and MyTest_new.DBF in the same folder. Is that possible?

Then a VB application created a temporary Access database and created a linked table targeting MYTest.DBF and then inserted records to it. I did not physically copy a linked table in MS Access.

Also this DBF does not have a FPT or CDX. Is that a worry?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 42

Expert Comment

by:pcelba
ID: 40564151
Yes, you can have many DBF files in one folder. The different filename is sufficient to recognize them.

The FPT and CDX files are optional and their existence depends on the DBF file structure. If you don't have them then it is OK.

I can say nothing about the VB application because it can contain anything... I just suppose it has some configuration which tells what DBF file to use and process.
0
 

Author Comment

by:Angel02
ID: 40564625
I did some tests and found this.
Even when I manually add these DBF files in an MS Access DB and run an UPDATE query in MS access on one of them, both MyTest.DBF and MyTest_new.DBF get updated. So it is not VB application's fault.

Then I added  MyTest.DBF and MyTest_new.DBF in a different folder (2) and when I updated MyTest_New.DBF in folder#2, it edited Mytest.DBF in folder#2 but did not update either DBF in Folder#1.

It looks like I cannot have  MyTest.DBF and MyTest_new.DBF in the same folder but I need to. Any suggestions?
0
 

Author Comment

by:Angel02
ID: 40564636
Also, whatever update I do, the last modified date of MyTest_new.DBF does not change in Windows Explorer. Only last modified date of MyTest.DBF changes. It looks like when I created  a linked table, it is just pointing to MyTest.DBF, even though I select MyTest_New.dbf as the target.
0
 
LVL 18

Accepted Solution

by:
Simon earned 250 total points
ID: 40564748
I see that you've put your question in the Foxpro topic area as well as Microsoft Access and Miscellaneous databases... Is the Foxpro application active while you're doing this copying? Did you check whether BDE was installed? I suspect that Foxpro is 'managing' everything in that folder and may see your new DBF as a partition of the original or a replication copy - it's many years since I did Foxpro development, and I'm not sure about its current abilities as an RDBMS.

Why do you need to have the DBF files in the same folder? Could you use a completely separate path for initial testing and confirm that your Access app can link to and update that DBF file independently?
0
 
LVL 42

Assisted Solution

by:pcelba
pcelba earned 250 total points
ID: 40564868
Interesting... But it is not so easy to help without any knowledge of your environment...

OK, Access has problems to access long file names sometimes (valid for DBF files).

Rename MyTest_new.dbf to MyTST2.dbf and try again.  Access must be able to link two different files in one folder.

Also, how the links to DBF files were created in Access? If you update MyTest but the change appears in "two files" but the last update date remains unchanged on the second file then it means both links point to ONE single file only. In other words links are not correct.

You should download some (free) DBF files viewer and check the DBF files content. If you have FoxPro then use FoxPro preferably.

What driver do you use to access DBF files from Access?
What MS Access version do you use?
0
 
LVL 36

Expert Comment

by:PatHartman
ID: 40569485
I can't shed any light on the current problem but I wanted to warn you that MS dropped support for the .dbf file format with A2013 so if you are thinking about "upgrading" soon, you will have to work around this somehow.

I am in the process of converting a FoxPro application to Access.  When I started, I had A2010 installed and so was able to link to the FoxPro files.  It turns out that I can continue to use those apps in A2013, probably because the supporting drivers are still installed.  It turns out that I can also create new links if I use the ODBC option.  It seems that just the .dbf option is gone from the ribbon but not the actual functionality as long as you stick to ODBC.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question