Copying back-end files from the front-end.

P

Peter Hallett

I have a split database, in which it would be particularly convenient if
front-end code could be used to copy tables in the back-end. So far, though,
I have been unable to achieve the desired results.
1. If the command “DoCmd.CopyObject, “tbl_Targetâ€, acTable, “tbl_Source†is
run in the front-end, a link to tbl_Target is created in the front-end but
the back-end contains no table called ‘tbl_Target’.
2. If the appropriate path is included in the above command, eg :–
DoCmd.CopyObject “C:\BackEndFolder\BackEndDatabase.mdbâ€, “tbl_Targetâ€,
acTable, “tbl_Source†– then tbl_Target appears in the back-end, as required,
but is shown as a link to tbl_Source.
3. If either of the above commands is run in the back-end then tbl_Target is
created in the form required.

Could someone please indicate whether what I am attempting is achievable
and, if so, how?
 
M

Mike Painter

Use TransferDatabase
DoCmd.TransferDatabase(TransferType, DatabaseType, DatabaseName, ObjectType,
Source, Destination, StructureOnly, StoreLogin)

It will have to have a name different from the linked file.
Note this will overwrite existing tables so an append query might be a
better way.
You might also be concerned with people not knowing which is which if they
have access
 
C

Clifford Bass

Hi Peter,

This should do it:

Dim appAccess As New Access.Application

With appAccess
.OpenCurrentDatabase "C:\BackEndFolder\BackEndDatabase.mdb"
.DoCmd.CopyObject , "tbl_Target", acTable, "tbl_Source"
.CloseCurrentDatabase
End With
Set appAccess = Nothing

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top