VBA to copy file from a folder to the other

F

Frank Situmorang

Hello,

Can anyone help me how can I copy my backend data from:
C:\Churchdata\BkEnd\Hahomion_be.mdb
To: C:\Churchdata\ChurchdataConso\BkEnd\Hahomion_be.mdb

I already have a query to append from:
C:\Churchdata\ChurchdataConso\BkEnd\Hahomion_be.mdb

But instead of asking user to copy file from the said folder, we better make
an commamd button name: DatatoOutBox

Thank in advance
 
J

John W. Vinson

Hello,

Can anyone help me how can I copy my backend data from:
C:\Churchdata\BkEnd\Hahomion_be.mdb
To: C:\Churchdata\ChurchdataConso\BkEnd\Hahomion_be.mdb

I already have a query to append from:
C:\Churchdata\ChurchdataConso\BkEnd\Hahomion_be.mdb

But instead of asking user to copy file from the said folder, we better make
an commamd button name: DatatoOutBox

Thank in advance

You can't copy "my backend" with a query (unless your database has only one
table, which isn't the case). And it is not a matter of copying a file (unless
you want to overwrite and destroy the entire database).

You can create a frontend with links to the tables in both backend databases,
and run as many Append queries as there are tables. The order of operations
will need careful thought to ensure relational integrity.

What is the purpose of this operation? Are you trying to make a complete
backup copy of Hahomion_be.mdb (in which case simply copying the .mdb file in
Windows Explorer would be better)? Are you trying to integrate existing data
in the BkEnd database with other data in the ChurchDataConso database, or
what?
 
F

Frank Situmorang

John:

In the church, this membership database will be mainly handled by a church
clerk, but before that the same database was also copyied to pastor's
computer. There are 2 tables in the database that need to be updated in the
pastor's computer wich is member table and address table.

I have created a button command to update/append:
1. Membersdata, this is the VBA
INSERT INTO bukuangkby ( NO_URTANGT, STAT_CODE, Addrs_ID, JnsAngt, NOIN,
TrnID, Dear, FNAME, MNAME, LNAME, NICKNAME, JenisKel, EmailAddress,
MobilPhone, MobilPhone2, [Language], Role, UrtRole, Hobbies, NotediRT,
TEMPTLAHIR, Imagepath, HLMNKEP_M, BAPTSOLH_M, TGLBPTIS_M, ATASSURT_M, ASAL1,
TGL_pen, ATSPERCA_M, ASAL2, HLMNKEP_K, PINDHKE_K, ATSSUR1_K, ATSSUR2_K,
KMATIAN_K, KELMURT_K, KETMURT_K, KELHILA_K, Note1, Res1, Res2, IDGereja,
DateUpdated )
SELECT a.NO_URTANGT, a.STAT_CODE, a.Addrs_ID, a.JnsAngt, a.NOIN, a.TrnID,
a.Dear, a.FNAME, a.MNAME, a.LNAME, a.NICKNAME, a.JenisKel, a.EmailAddress,
a.MobilPhone, a.MobilPhone2, a.Language AS Expr1, a.Role, a.UrtRole,
a.Hobbies, a.NotediRT, a.TEMPTLAHIR, a.Imagepath, a.HLMNKEP_M, a.BAPTSOLH_M,
a.TGLBPTIS_M, a.ATASSURT_M, a.ASAL1, a.TGL_pen, a.ATSPERCA_M, a.ASAL2,
a.HLMNKEP_K, a.PINDHKE_K, a.ATSSUR1_K, a.ATSSUR2_K, a.KMATIAN_K, a.KELMURT_K,
a.KETMURT_K, a.KELHILA_K, a.Note1, a.Res1, a.Res2, a.IDGereja, a.DateUpdated
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].bukuangkby AS a
WHERE (((Exists (SELECT *
FROM bukuangkby
WHERE bukuangkby.NO_URTANGT = a.NO_URTANGT))=False));

2. Append address data:
INSERT INTO KbyAngAlamat ( AddresID, NO_UKK, HOUSEHOLDNAME, RADDRESS1,
RADDRESS2, RADDRESS3, RKODEPOS, RTELP, RTELP2, No_Fax, [Note] )
SELECT a.AddresID, a.NO_UKK, a.HOUSEHOLDNAME, a.RADDRESS1, a.RADDRESS2,
a.RADDRESS3, a.RKODEPOS, a.RTELP, a.RTELP2, a.No_Fax, a.Note
FROM [C:\Churchdata\Churchdataconso\BkEnd\Hahomion_be.mdb].KbyAngAlamat AS a
WHERE (((Exists (SELECT *
FROM KbyAngAlamat
WHERE KbyAngAlamat.AddresID = a.AddresID))=False));


John as you see it takes from certain folder, and the name of the table will
be the same. So instead of using Windows explorer, it is better to have an
VBA of command button to transfer the dabatase (Hahomion_be.mdb)

Thanks for your advice
 

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