Dim AdoPropCn As New Connection
'创建表
If AdoPropCn.State <> adStateClosed Then
AdoPropCn.Close
End If
AdoPropCn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\" & DataBaseFolder & "\" & DataBaseName & ".mdb"
' AdoPropCn.Execute " if exists(select * from sysobjects where id = object_id(N'TableReportLS') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table TableReportLS"
AdoPropCn.Execute "CREATE TABLE " & DataBaseName & _
"( frmname varchar(20) not null,pageHcenter bit,pageVcenter bit,Lmargin real,Rmargin real,Tmargin real,Bmargin real,pageFit bit,pageWide smallint,pageHight smallint,pageRow smallint,FixCols tinyint,pageScale real,showTabs tinyint,Gridlines bit,rowHead bit,colHead bit,zerovalues bit,rowmode bit)"
AdoPropCn.Execute "CREATE TABLE " & DataBaseName & "Dtl" & _
"( frmname varchar(20) not null,colNumber tinyint,colWidth int)"
AdoPropCn.Close
End If
'创建表
If AdoPropCn.State <> adStateClosed Then
AdoPropCn.Close
End If
AdoPropCn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\" & DataBaseFolder & "\" & DataBaseName & ".mdb"
' AdoPropCn.Execute " if exists(select * from sysobjects where id = object_id(N'TableReportLS') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table TableReportLS"
AdoPropCn.Execute "CREATE TABLE " & DataBaseName & _
"( frmname varchar(20) not null,pageHcenter bit,pageVcenter bit,Lmargin real,Rmargin real,Tmargin real,Bmargin real,pageFit bit,pageWide smallint,pageHight smallint,pageRow smallint,FixCols tinyint,pageScale real,showTabs tinyint,Gridlines bit,rowHead bit,colHead bit,zerovalues bit,rowmode bit)"
AdoPropCn.Execute "CREATE TABLE " & DataBaseName & "Dtl" & _
"( frmname varchar(20) not null,colNumber tinyint,colWidth int)"
AdoPropCn.Close
End If
Set tblNew=CurrentDB().CreateTable("YourTable")
With tblNew
.Field.Append .CreateField("Field1",dbText,10)
...
End With
CurrentDB().TableDefs.Append tblNew