hi Frank all you need to do is to create the database (I'll use DAO as its Access) object and use<br>a normal SQL script to create the table and then using the tabledef object set the various field <br>properties such as AllowZeroLength and DefaultValue<br><br>Dim oMacroDatabase as Database<br>Dim oTableDef as tabledef<br>Dim sPath as String<br><br>'sPath is the path and Filename of your database<br> Set oMacroDatabase = DBEngine.Workspaces(0).CreateDatabase(sPath, dbLangGeneral)<br> <br>'Create the table fields, Constraints,Index's,Primary Key<br><br> sSQL = " CREATE TABLE ClinicalTrial ( ClinicalTrialId INTEGER ,"<br> sSQL = sSQL & " ClinicalTrialName TEXT(15),"<br> sSQL = sSQL & " ClinicalTrialDescription TEXT (255),"<br> sSQL = sSQL & " PhaseId SMALLINT , StatusId SMALLINT ,"<br> sSQL = sSQL & " Keywords TEXT (255), ExpectedRecruitment INTEGER ,"<br> sSQL = sSQL & " ActualRecruitment INTEGER ,"<br> sSQL = sSQL & " TrialTypeId SMALLINT ,"<br> sSQL = sSQL & " CONSTRAINT ClinicalTrialName UNIQUE (ClinicalTrialName),"<br> sSQL = sSQL & " CONSTRAINT ClinTrial_PrimaryKey PRIMARY KEY"<br> sSQL = sSQL & " (ClinicalTrialID))"<br> oMacroDatabase.Execute sSQL, dbFailOnError<br><br> sSQL = " CREATE UNIQUE INDEX idx_ClinicalTrialId "<br> sSQL = sSQL & "ON ClinicalTrial ( ClinicalTrialId )"<br> oMacroDatabase.Execute sSQL, dbFailOnError<br> <br> sSQL = " CREATE UNIQUE INDEX idx_ClinicalTrialName "<br> sSQL = sSQL & "ON ClinicalTrial ( ClinicalTrialName )"<br> oMacroDatabase.Execute sSQL, dbFailOnError<br> <br> sSQL = " CREATE INDEX idx_PhaseId "<br> sSQL = sSQL & "ON ClinicalTrial ( PhaseId )"<br> oMacroDatabase.Execute sSQL, dbFailOnError<br><br> sSQL = " CREATE INDEX idx_StatusId "<br> sSQL = sSQL & "ON ClinicalTrial ( StatusId )"<br> oMacroDatabase.Execute sSQL, dbFailOnError<br> <br>'-------------------------------------------------------------------------------------<br>'To access the field properties refresh the database so that tabledefs collection<br>' recognises the ClinicalTrial tabel as a valid table<br>'-------------------------------------------------------------------------------------<br>oMacroDatabase.TableDefs.Refresh<br><br> Set oTableDef = oMacroDatabase.TableDefs("ClinicalTrial"

<br> With oTableDef<br> .Fields("ClinicalTrialId"

.DefaultValue = 0<br> .Fields("ClinicalTrialId"

.Required = False<br> .Fields("ClinicalTrialName"

.AllowZeroLength = False<br> .Fields("ClinicalTrialDescription"

.AllowZeroLength = True<br> .Fields("ClinicalTrialDescription"

.Required = False<br> .Fields("PhaseId"

.DefaultValue = 0<br> .Fields("PhaseId"

.Required = False<br> .Fields("StatusId"

.DefaultValue = 0<br> .Fields("StatusId"

.Required = False<br> .Fields("Keywords"

.AllowZeroLength = True<br> .Fields("Keywords"

.Required = False<br> .Fields("ExpectedRecruitment"

.DefaultValue = 0<br> .Fields("ExpectedRecruitment"

.Required = False<br> .Fields("ActualRecruitment"

.DefaultValue = 0<br> .Fields("ActualRecruitment"

.Required = False<br> .Fields("TrialTypeId"

.DefaultValue = 0<br> .Fields("TrialTypeId"

.Required = False<br> End With<br><br>I've just used one of the tables from my database so just change the field names and <br>datatypes as required...<br><br>To delete a table just use the Drop table statement but this will mean you lose all data in the<br>table as well.<br><br>Good luck <br>Will<br>