For the next month we are offering a free annual subscription to anyone that submits source code for an issue which gets published. If you have some useful source code would be valuable for our members, fill out the form at http://www.codeoftheweek.com/submissions.html
Please make sure all source code is tested and is in working condition. We are looking for all types of source from database access routines to API calls to graphics routines. We are not looking for one or two lines tricks at this time (this will be a future offering) . The source code should be at least 10 or 15 lines of long, preferably longer. It should be commented or at least readable by the average programmer.
If you are currently a member of Code of the Week we will extend your subscription an additional year.
Get your copy of PowerFindPro for only $19.95 (regularly $24.95). You can get full information on the product at http://www.codeoftheweek.com/powerfindpro
You can order PowerFindPro at this great price at http://www.codeoftheweek.com/orderforms/pfp.html
In this issue we discuss how to copy a database table structure using some standard SQL instructions.
This source code is designed for VB 3.0 and up. Questions? Email us at questions@codeoftheweek.com.
The basDatabase module contains a single function that copies a the structure of a database table into another table name. It accomplishes this by using the INTO SQL clause. There is a topic in the Jetsql35.hlp that comes with Visual Basic 5.0 called "SELECT...INTO" that fully discusses the various options on this powerful statement. This routine could easily be extended to do database backups of tables. If you are interested in this, drop us an email at dbissues@codeoftheweek.com
Public Function CopyTableStructure(sSourceDB As String, sSourceTable As String, _ sDestinationTable As String) As Boolean
The below sample copies the table structure of the POS table in the database e:\temp\pos.mdb to posimport.
If CopyTableStructure("e:\temp\pos.mdb", "pos", "posimport") Then MsgBox "Table copied" Else MsgBox "Table not copied" End If
To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0079.html