Table to Code Wizard
========================
-----------------------------------------------------------------------
| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY     |
| ACCOMPANY THIS DOCUMENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY |
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |           
| IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A          |                  
| PARTICULAR PURPOSE. The user assumes the entire risk as to the      |                                      
| accuracy and the use of this Application. This Application may be   |
| copied and distributed subject to the following conditions:  1) All |
| text must be copied without modification and all pages must be      |
| included;  2) All files must be copied without modification         |
| 3)All components of Application must be distributed together;       |
| and 4)This Application may not be distributed for profit.           |           |
|                                                                     |
| Author: Eric Leder. All Rights Reserved.                            |
| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |
| and Windows is a trademark of Microsoft Corporation.                |
| CompuServe is a registered trademark of CompuServe, Inc.            |
|---------------------------------------------------------------------|

    

INTRODUCTION
------------


This Code Wizard generates code for a subroutine that can create a table.
The table that is created is a "close" copy of a table selected by the user.
A "close" copy means that it has the same fields, which have the same name,
data type, size and attributes as the original table's fields, and the same
indexes. The original field's other properties such as Default Value, 
Input Mask, Validation Rule, etc. are left blank in this version.
 
This utility is meant to provide a short cut for programming when a table
needs to be produced by Access Basic Code, such as a temporary table or
when a Database is created by code.


FILES INCLUDED:
--------------
	TBLCODE.TXT --- this file
        TBLCODE.MDA --- Access 2.0 Library file

INSTALLATION
------------ 

Copy TBLCODE.MDA into the same directory that contains MSACCESS.EXE.
Then open an Access DataBase and install this library by using the
Add-In Manager:  From the File menu choose Add_ins, and then choose
Add-In Manager. Under AVAILABLE LIBRARIES the item 
 
                 Build Code to Make a Table 

should appear. Select that item and choose INSTALL. If it doesnt appear
use ADD NEW... to open a dialog to locate the TBLCODE.MDA file.

Alternatively, you can use TBLCODE.MDA as a regular database.
  

  
INSTRUCTIONS FOR USE AS A LIBRARY
-----------------------------------

Open the Module that you wish to have the "Make_Table" subroutine 
placed in. Then select "Make Table Code" from the Add-In Menu. 
A dialog form will appear offering a choice of the tables available in
the current database. If you desire another Database's table, you 
should Attach it from the DataBase window first. Once selected the
TBLCODE.MDA uses SendKeys to enter a subroutine into your module. 
This may cause problems if there is a duplication of procedure names.
TBLCODE.MDA creates a name for the procedure of:

    "Make_Table_" & modified([Table Name]) & random number(0-99)

where [Table Name] is modified so that it is a legal Access Basic Procedure
name (blanks and other illegal characters are substituted with _'s). 
The random number is added to decrease the chance of a duplicate procedure
name which would cause a SendKey STORM on your keyboard buffer!
It is suggested that you make only one subroutine for making a particular
table and if you need more than one copy then change the name of 
the first SUB before making a second one.

An option for inclusion of error handling code can be exercised by setting
the check box on the dialog form.


ADDITIONAL INSTRUCTIONS FOR USE AS A REGULAR DATABASE
-----------------------------------------------------

You can directly open TBLCODE.MDA as a regular database.
You can call the code creating routine with the MACRO: Create Table Code.

To make code for a table to be used in another database, the steps that 
should be followed are:

1. Open TBLCODE.MDA as a regular database
2. Attach the desired table to TBLCODE.MDA
   (from File Menu select Attach Table...)
3. Create a New Module
4. From File Menu select Run Macro...
5. Select: Create Table Code
6. After code is created and compiled either Export the module to the
   desired DataBase or if another instance of ACCESS is running with 
   your DataBase, then copy the subroutine from TBLCODE.MDA and then
   activate the other instance containing your DataBase and then Paste
   the subroutine into the desired module.


INSTRUCTIONS FOR USING THE Make_Table_x Subroutine
--------------------------------------------------

The Subroutine requires two parameters:

     strName = Name of Table to be created
     db      = DataBase that table is to be created in

Therefore to call the subroutine you should have a Database object 
variable available for creating the table in. A call of the subroutine
could take the form:

	Make_Table_{Table Name} "Example",db

Example:
-------

If I made a subroutine based on the UsysAddIns table the Code wizard 
might create a subroutine named "Make_Table_USysAddIns18", to make new 
UsysAddIns in another database and the current database I could use
this code:   

Dim dbExample as DataBase,dbCurrent as DataBase
' define database objects
Set dbCurrent=DBEngine(0)(0)
Set dbExample=DBEngine(0).CreateDataBase("C:\TEMP\EXAMPLE.MDB",DB_LANG_GENERAL)
' make structure of UsysAddIns in Example database
Make_Table_USysAddIns18 "UsysAddIns",dbExample
' make a structural backup of it in current database 
Make_Table_USysAddIns18 "UsysBackUp",dbCurrent

--------------------------------------------------------------------------


COMMENTS, SUGGESTIONS, AND QUESTIONS ARE WELCOME:
-------------------------------------------------

Please send to:
	Eric Leder
	CompuServe ID: 72652,2427 




 