"Lyle Fairfield" <ly***********@aim.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Beowulf wrote:
I'm
primarily concerned at the moment with translating a function of the
original application where it could create empty MDB files at the
request of the user.
From an ADP connected to Database Temp on Server FFDBA\SQLExpress
I run this code
DoCmd.TransferSQLDatabase "FFDBA\SQLExpress", "Temp2", , , , False
A new copy (without data) of Temp called Temp2 is created on
FFDBA\SQLExpress.
Well you certainly can't get much quicker than that! I had never used this
as I don't have any adp's in production - but I just tried it and have still
not managed to make it work. The first error involved invalid user accounts
which were transferred from a previous domain and should have been deleted
anyway - so this was an easy fix. The second error was a bit more obscure
and I still need to fix it but it is related to this post:
http://groups.google.com/group/comp....ab321f52403115
The third error is caused by running this code for a second time, which does
not allow you to delete the first copy and replace it with a second, so you
have to find another way to check and prompt whether to overwrite. With all
of these little things, you have no fine control over what happens and you
only have one line of code to succeed or fail, and if it does fail, you may
well be left with a partially completed database.
What this method does is to try and create a copy of what is currently there
and as I have found out, there may be objects present that shouldn't be
there for whatever reason. Perhaps some person or process has screwed
things up and you want to start again with a fresh database with objects as
they should be, not a copy of the current situation.
I suppose it's fairly obvious really: the built-in method is quick and easy
but offers no flexibility. Building you own function, is a lot more work
but you would have much tighter control over what happens.