Solved

Copying a DBF file fails

Posted on 2015-01-21
9
256 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
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 18

Expert Comment

by:SimonAdept
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 41

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
 
LVL 41

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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:
SimonAdept 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 41

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 34

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now