Alpha Video Training
Results 1 to 6 of 6

Thread: Copy Open Dbf

  1. #1
    "Certified" Alphaholic Charles Hoens's Avatar
    Real Name
    Charles Hoens
    Join Date
    Sep 2000
    Location
    Princeton, NJ
    Posts
    1,171

    Default Copy Open Dbf

    I've looked around through the forum, but surprisingly I could not find an instance of someone having this problem. I have a networked app where people are constantly putting things into one particular dbf. Every 15 minutes or so I want a copy operation to run taking just the daily records from today and copying them to another database. Easy to do? Well, I keep getting an error on the copy operation saying that "the process cannot access the file, because it is being used by another process" which to me means that the dbf is open. I'm not sure why the copy process needs exclusive access and I haven't tried coding it outside of the operation code, but why is this so and secondly is there some sort of workaround anyone has thought of?

    Many thanks!

    Charlie

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Copy Open Dbf

    Try this as the field rule onsaverecord event code for the table you are copying from.


    Code:
    dim tbl_source as P
    tbl_source = table.current()
    on error goto failed_to_copy
    result = tbl_source.copy_record_to("tabletocopyto")
    on error goto 0
    end
    
    failed_to_copy:
        ui_msg_box("Record not copied.", error_text_get(error_code_get()))
    end
    Your current table and the table you are currenty appending to should always be in sync.
    There can be only one.

  3. #3
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default Re: Copy Open Dbf

    Stan, this may be more complicated. Won't your approach create new records in the external table each time a change is made to an existing record? Charlie hasn't given us many details. It's not clear how he handles edits to existing records. Presumably the copy op would create multiple records in the receiving table, though I'm not sure.

    Charlie, it's odd to me that you're using a copy operation instead of an append. Are you creating separately named tables every 15 minutes?

    -- tom

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Copy Open Dbf

    Won't your approach create new records in the external table each time a change is made to an existing record?
    Yep. Didn't think of that.
    There can be only one.

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Copy Open Dbf

    Maybe use the result of the suggested code to add records to an intermediary table from which one would append unique, replace existing to the final table?
    There can be only one.

  6. #6
    "Certified" Alphaholic Charles Hoens's Avatar
    Real Name
    Charles Hoens
    Join Date
    Sep 2000
    Location
    Princeton, NJ
    Posts
    1,171

    Default Re: Copy Open Dbf

    Thanks guys! With all the coding I am doing it was just odd to run into this. As way of more information, the reason I am copying the selected information was to save time and speed up input. The copied info was placed from dbf1into dbf2 and then dbf2 was FTP'd to my VPS server. Actually I was only copying from dbf1 the records for that particular day. This helps out on the network strain and also on the size of the transmitted FTP file. And, if the FTP transfer fails, it doesn't create problems for dbf1.

    But, why does the copy operation need exclusive access? Would an export operation require exclusive access?

    I'll try the different solutions and let you know.

    Thanks as always. You guys are the best!

    Charlie

Similar Threads

  1. ,dbf and Open Office
    By forskare in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 02-15-2009, 12:15 AM
  2. cannot open FoxPro .dbf files
    By Jay Talbott in forum Alpha Five Version 8
    Replies: 9
    Last Post: 08-13-2008, 04:39 PM
  3. re: indexing when open dbf
    By jerry jones in forum Alpha Five Version 5
    Replies: 13
    Last Post: 06-04-2005, 10:38 AM
  4. So, am I safe to copy .dbf files?
    By Wanda Tucker in forum Alpha Five Version 5
    Replies: 6
    Last Post: 04-20-2004, 02:54 PM
  5. Script to Copy dbf to differnet directory
    By Tim Sutherland in forum Alpha Five Version 4
    Replies: 1
    Last Post: 05-16-2001, 02:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •