Public Sub CreateDB(sDBXLS As String)
Dim tdExample As TableDef
Dim fldID As Field
Dim dbDatabase As Database
Dim sNewDBPathAndName, sDBPath As String
Dim WB As Excel.Workbook, WS As Excel.Worksheet
sNewDBPathAndName = sDBPath
Set dbDatabase = CurrentDb 'CreateDatabase(sNewDBPathAndName, dbLangGeneral, dbEncrypt)
Set tdExample = dbDatabase.CreateTableDef("NewInvoice")
Set fldID = tdExample.CreateField("ID", dbInteger)
fldID.Attributes = dbAutoIncrField
Set fldJob = tdExample.CreateField("Job", dbText, 50)
Set fldStyle = tdExample.CreateField("Style", dbText, 50)
Set fldType = tdExample.CreateField("Type", dbText, 20)
Set fldkt = tdExample.CreateField("kt", dbText, 5)
Set fldcolor = tdExample.CreateField("color", dbText, 5)
Set fldQty = tdExample.CreateField("Qty", dbInteger)
Set fldUnit = tdExample.CreateField("Unit", dbText, 5)
Set fldDIA = tdExample.CreateField("DIA", dbDouble)
Set fldTotalGr = tdExample.CreateField("TotalGr", dbDouble)
Set fldLaborU = tdExample.CreateField("LaborU", dbCurrency)
Set fldUCost = tdExample.CreateField("UCost", dbCurrency)
Set fldTotalCost = tdExample.CreateField("TotalCost", dbCurrency)
tdExample.Fields.Append fldID
tdExample.Fields.Append fldJob
tdExample.Fields.Append fldStyle
tdExample.Fields.Append fldType
tdExample.Fields.Append fldkt
tdExample.Fields.Append fldcolor
tdExample.Fields.Append fldQty
tdExample.Fields.Append fldUnit
tdExample.Fields.Append fldDIA
tdExample.Fields.Append fldTotalGr
tdExample.Fields.Append fldLaborU
tdExample.Fields.Append fldUCost
tdExample.Fields.Append fldTotalCost
dbDatabase.TableDefs.Append tdExample
|