AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

Export to any type of database

Everyone tells you how to import, but even most MS-VB techs start coughing when you ask how to export with DAO!

Use this code to get data out to different formats without requiring a complete copy of any DBMS on the user machine.

Create a new project with a command button and a DAO3.5 reference, then copy this code to the button's Click event (snippet assumes the MS sample file biblio.mdb is in the application path):

 Dim db as database
Set db = Workspaces(0).OpenDatabase(app.path & "\biblio.mdb")
'commented out syntax followed by working example
'db.execute "SELECT tbl.fields INTO [dbms type;DATABASE=path].[unqualified 'filename] FROM [table or tables]
db.execute "SELECT * INTO [dBase III;DATABASE="C:\My Documents].[testa] FROM [authors]"

By using the brackets and dot operator, you get a completely proper output in the ISAM database type of your choice.  Also, if you choose Text as the database type, the statement creates a Schema.ini for you automatically, or adds a new section for your new data file to a Schema.ini already in the path folder.

Now you can do any kind of export the client wants without using a DBMS on the machine.   This makes your life easier when you notice that some of your users running Word97 have problems mail-merging with text files you originally created with traditional (and slower) Write# and Print# methods.

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/