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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying opened tables from FoxPro

Status
Not open for further replies.

Dabase

Programmer
Apr 2, 2004
122
PT
Hi,

Is there any way of copying opened FoxPro tables to another location?

Any help on this will be much appreciated.



Thanks
Dabase
 


The DOS copy file will copy opened tables. Just create a batch file that will copy you open tables (and indexes).

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
You can use COPY TO - if a table is opened by you.

COPY TO D:\NewLocation\NewName WITH CDX

I someone else (or another application) holds it open, then you can use DOS commands, as Mike Gagnon suggested.
 
Oh, and if someone else has the file opened exclusively, it appears that even DOS wouldn't help.
 
dabase,

i use WSH's CopyHere and it works on dbf's opened exclusively, too. i also learned this from the great tipmasters of this great forum. so here's a sample code:

Code:
function wincopy
parameter fldrsource, fldrtarget
ParentFolder = fldrtarget
objShell = CreateObject("Shell.Application")
objFolder = objShell.NameSpace(ParentFolder)
objFolder.CopyHere(fldrsource, 16 + 64)

you can call it something like this:

Code:
=wincopy("\\SourcePC\WrkDir\VFP6\CardLog.*", "c:\XTemp")

take note that the folder XTemp should exist prior to calling the function.

i hope this helps. peace! [peace]

kilroy [trooper]
philippines

"Illegitimis non carborundum!"
-Gen. Joseph Stilwell
 
Kilroy,

I get an error when I try to copy an exclusively used table using your code.

I believe that there is NO WAY to copy or otherwise access an exclusively used table other that through the instance of VFP using the table.

Brian
 
sir brian,

that is strange because we have a commercial app, which i believe was written in VB that came along with our door access units, that also accesses a VFP table exclusively thru ODBC (i linked this VFP table to an MSAccess database). i said exclusively because whenever i try to open the table in VFP environment, shared or otherwise, it gives me a "File access denied." error message. but still, i can copy it using the code above. or maybe the table is not really opened exclusively by VB. i dunno cuz i don't have the codes of that VB app. hmmm... strange. maybe someone could explain? [ponder]

peace! [peace]

kilroy [trooper]
philippines

"Illegitimis non carborundum!"
-Gen. Joseph Stilwell
 
forgot to mention, i use vfp6 on a win98se environment. the vfp table, together with the MSAccess database where it is linked to, resides in a Novell 4 server.

kilroy [trooper]
philippines

"Illegitimis non carborundum!"
-Gen. Joseph Stilwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top