Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Working with MSAccess Databases
Author:
Daniel M. Ionescu
E-mail:
Click to e-mail author
Submitted:
8/27/2003
Version:
VB6
Compatibility:
VB6
Category:
Databases
Views:
17177
This code allows to export data from the current database to a back-up database.
Declarations:
Dim appAccess As Access.Application Dim dat As String
Code:
Set appAccess = New Access.Application dat = App.Path & "\BACKUP.mdb" 'Open and set the path for the current database appAccess.OpenCurrentDatabase App.Path & "\CURRENT.mdb" 'Creates a new table in the current database appAccess.DoCmd.RunSQL ("CREATE TABLE new_table (column1_name varchar, column2_name varchar)") 'Populate the new table with the data selected from the old table in the same database appAccess.DoCmd.RunSQL ("INSERT INTO new_table SELECT column1_name, column2_name FROM old_table") 'Export the new table from current database to Arhi table in the back-up database appAccess.DoCmd.TransferDatabase acExport, "Microsoft Access", dat, acTable, "new_table", "Arhi" MsgBox "Database created !" 'Close the current database appAccess.CloseCurrentDatabase appAccess.Quit
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement