Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009

    Unanswered: TransferDatabase doesn't work properly

    Hi again,
    ok, here's one for you: I can't get this line of code to work correctly:

    DoCmd.TransferDatabase acExport, "Microsoft Access", strDbPath, acTable, strFrom, strTo, True
    it simply doesn't do anything. However, if I tell it to export not only structure, but also the data (change last variable to False), it works!
    Question is, why can't I export empty table to get it's structure only?

    FYI, the target db is locted on the same hard drive and I'm positive that it's correct path and file name bacause it works in other instance.
    I currently stuck with importing the whole thing, but if the source table is very large, it takes very long time to transfer lots of data that I don't need anyway, so I delete it in next line using:
    DoCmd****nSQL "DELETE * FROM [" & strTo & "]"
    which also takes time.

    Any help much appreciated.

  2. #2
    Join Date
    May 2010
    Just a thought on a way to make it better:

    1) run a make table that select no records from the original table into a temporary table name. This will make a blank tbale with the structure in the local database.

    2) export this blank temporary table giving it the correct name ion the destination database.
    Boyd Trimmell aka HiTechCoach (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  3. #3
    Join Date
    May 2004
    New York State
    You might want to try the DoCmd.OutputTo method. I'm not sure whether it works on structure only requirement.


Posting Permissions

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