Solved

Copying a DBF file fails

Posted on 2015-01-21
9
260 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: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 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

920 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

12 Experts available now in Live!

Get 1:1 Help Now