Back up Access database using SQL statement

xiaoxiao2021-03-06  74

Description:

1. To back up the database (Medicine.MDB) has the following forms: ENTER table, exit table, Store Table

.........

2. Backup database (buMedicine.mdb) is placed in the DBBackup subdirectory of the current path.

3. Use the select ..... INTO ..... in SQL, add inquiry to Medicine.mdb,

Being the same as Medicine.mdb

The form is stored in the external database buMedicine.mdb.

4. Detailed program code is as follows:

Private subcmdbackup_click ()

DIM DBBU AS DATABASE

DIM STRSQL AS STRING

Dim dbuname as string

DBBuname = app.path & "/dbbackup/bumedicine.mdb"

IF Dir (DBBuname) <> "" "" "

Set dbbu = workspaces (0) .createdatabase (app.path & "/ dbbackup / buMedici

Ne.mdb ", dblanggeneral)

SET DBBU = OpenDatabase (app.path & "/medicine.mdb", false, false)

strsql = "SELECT ENTER. * INTO ENTER IN '" & dbbuname & "' from enter;"

Dbbu.execute strsql

Strsql = "SELECT EXIT. * INTO EXIT IN '" & dbbuname & "' from exit;"

Dbbu.execute strsql

Strsql = "Select Store. * INTO Store in '" & dbbuname & "' from store;"

Dbbu.execute strsql

..............

dbbu.close

SET DBBU = Nothing

转载请注明原文地址:https://www.9cbs.com/read-93898.html

New Post(0)