Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub CreateMdbDatabase()
Dim adxCat As ADOX.Catalog
Dim adxTable As ADOX.Table
Dim Conn
' ADOX: create database
Set adxCat = New ADOX.Catalog
adxCat.Create ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "DataBasePathAndName.mdb" & ";" & _
"Jet OLEDB:Engine Type=5")
Conn = adxCat.ActiveConnection
' ADOX: create table
Set adxTable = New ADOX.Table
With adxTable
.Name = "Table1"
With .Columns
.Append "Field1", adDate ' date
.Append "Field2", adSmallInt ' integer
.Append "Field3", adUnsignedTinyInt ' byte
.Append "Field4", adVarWChar, 1 ' string, field size=1
.Append "Field5", adInteger ' long integer
.Append "Field6", adDouble ' double
.Append "Field7Optional", adVarWChar, 1 ' string, field size=1
.Item("Field7Optional").Attributes = adColNullable ' allow null
End With
End With
adxCat.Tables.Append adxTable
Set adxTable = Nothing
' ADO: access to table 1
Dim adoRs As ADODB.Recordset
Set adoRs = New ADODB.Recordset
adoRs.Open _
Source:="Table1", _
ActiveConnection:=Conn, _
CursorType:=adOpenKeyset, _
LockType:=adLockPessimistic, _
Options:=adCmdTable
' fill "Table1"
adoRs.Close
Set adoRs = Nothing
Set adoRs = Nothing
End Sub
' ADOX: create table
Set adxTable = New ADOX.Table
With adxTable
.Name = "Table1"
With .Columns
.Append "Field1", adDate ' date
.Append "Field2", adSmallInt ' integer
.Append "Field3", adUnsignedTinyInt ' byte
.Append "Field4", adVarWChar, 1 ' string, field size=1
.Append "Field5", adInteger ' long integer
.Append "Field6", adDouble ' double
.Append "Field7Optional", adVarWChar, 1 ' string, field size=1
.Item("Field7Optional").Attributes = adColNullable ' allow null
End With
End With
adxCat.Tables.Append adxTable
Set adxTable = Nothing
' ADO: access to table 1
Dim adoRs As ADODB.Recordset
Set adoRs = New ADODB.Recordset
adoRs.Open _
Source:="Table1", _
ActiveConnection:=Conn, _
CursorType:=adOpenKeyset, _
LockType:=adLockPessimistic, _
Options:=adCmdTable