Constant | Description |
dbBigInt | Big Integer |
dbBinary | Binary |
dbBoolean | Boolean |
dbByte | Byte |
dbChar | Char |
dbCurrency | Currency |
dbDate | Date/Time |
dbDecimal | Decimal |
dbDouble | Double |
dbFloat | Float |
dbGUID | GUID |
dbInteger | Integer |
dbLong | Long |
dbLongBinary | Long Binary (OLE Object) |
dbMemo | Memo |
dbNumeric | Numeric |
dbSingle | Single |
dbText | Text |
dbTime | Time |
dbTimeStamp | Time Stamp |
dbVarBinary | VarBinary |
Constant | Query type |
dbQAction | Action |
dbQAppend | Append |
dbQCompound | Compound |
dbQCrosstab | Crosstab |
dbQDDL | Data-definition |
dbQDelete | Delete |
dbQMakeTable | Make-table |
dbQProcedure | Procedure (ODBCDirect workspaces only) |
dbQSelect | Select |
dbQSetOperation | Union |
dbQSPTBulk | Used with dbQSQLPassThrough to specify a query that doesn't return records (Microsoft Jet workspaces only) |
dbQSQLPassThrough | Pass-through (Microsoft Jet workspaces only) |
dbQUpdate | Update |
Constant | Recordset type |
dbOpenTable | Table (Microsoft Jet workspaces only) |
dbOpenDynamic | Dynamic (ODBCDirect workspaces only) |
dbOpenDynaset | Dynaset |
dbOpenSnapshot | Snapshot |
dbOpenForwardOnly | Forward-only |
Constant | Workspace type |
dbUseJet | The Workspace is connected to the Microsoft Jet database engine. |
dbUseODBC | The Workspace is connected to an ODBC data source. |
Constant | Table field setting | Query parameter setting |
dbBoolean | Yes/No | Yes/No |
dbByte | Number (FieldSize = Byte) | Byte |
dbCurrency | Currency | Currency |
dbDate | Date/Time | Date/Time |
dbDouble | Number (FieldSize = Double) | Double |
Constant | Table field setting | Query parameter setting |
dbGUID | Number or AutoNumber (FieldSize = ReplicationID) | Not supported |
dbInteger | Number (FieldSize = Integer) | Integer |
dbLong | Number (FieldSize = Long Integer) | Long Integer |
AutoNumber (FieldSize = Long Integer) | Not supported | |
dbLongBinary | OLE Object | OLE Object |
Not supported | Binary | |
dbMemo | Memo | Memo |
dbSingle | Number (FieldSize = Single) | Single |
dbText | Text | Text |
Not supported | Not supported | Value |
Sub TypeX()
Dim dbsNorthwind As Database
Dim rstEmployees As Recordset
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
' Default is dbOpenTable.
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees")
Debug.Print _
"Table-type recordset (Employees table): " & _
RecordsetType(rstEmployees.Type)
rstEmployees.Close
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees", _
dbOpenDynaset)
Debug.Print _
"Dynaset-type recordset (Employees table): " & _
RecordsetType(rstEmployees.Type)
rstEmployees.Close
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees", _
dbOpenSnapshot)
Debug.Print _
"Snapshot-type recordset (Employees table): " & _
RecordsetType(rstEmployees.Type)
rstEmployees.Close
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees", _
dbOpenForwardOnly)
Debug.Print _
"Forward-only-type recordset (Employees table): " & _
RecordsetType(rstEmployees.Type)
rstEmployees.Close
dbsNorthwind.Close
End Sub
Function RecordsetType(intType As Integer) As String
Select Case intType
Case dbOpenTable
RecordsetType = "dbOpenTable"
Case dbOpenDynaset
RecordsetType = "dbOpenDynaset"
Case dbOpenSnapshot
RecordsetType = "dbOpenSnapshot"
Case dbOpenForwardOnly
RecordsetType = "dbOpenForwardOnly"
End Select
End Function
This example demonstrates the Type property by returning the name of the constant corresponding to the value of the Type property of all the Field objects in the Employees table. The FieldType function is required for this procedure to run.
Sub TypeX2()
Dim dbsNorthwind As Database
Dim fldLoop As Field
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
Debug.Print "Fields in Employees TableDef:"
Debug.Print " Type - Name"
' Enumerate Fields collection of Employees table.
For Each fldLoop In _
dbsNorthwind.TableDefs!Employees.Fields
Debug.Print " " & FieldType(fldLoop.Type) & _
" - " & fldLoop.Name
Next fldLoop
dbsNorthwind.Close
End Sub
Function FieldType(intType As Integer) As String
Select Case intType
Case dbBoolean
FieldType = "dbBoolean"
Case dbByte
FieldType = "dbByte"
Case dbInteger
FieldType = "dbInteger"
Case dbLong
FieldType = "dbLong"
Case dbCurrency
FieldType = "dbCurrency"
Case dbSingle
FieldType = "dbSingle"
Case dbDouble
FieldType = "dbDouble"
Case dbDate
FieldType = "dbDate"
Case dbText
FieldType = "dbText"
Case dbLongBinary
FieldType = "dbLongBinary"
Case dbMemo
FieldType = "dbMemo"
Case dbGUID
FieldType = "dbGUID"
End Select
End Function
This example demonstrates the Type property by returning the name of the constant corresponding to the value of the Type property of all the QueryDef objects in Northwind. The QueryDefType function is required for this procedure to run.
Sub TypeX3()
Dim dbsNorthwind As Database
Dim qdfLoop As QueryDef
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
Debug.Print "QueryDefs in Northwind Database:"
Debug.Print " Type - Name"
' Enumerate QueryDefs collection of Northwind database.
For Each qdfLoop In dbsNorthwind.QueryDefs
Debug.Print " " & _
QueryDefType(qdfLoop.Type) & " - " & qdfLoop.Name
Next qdfLoop
dbsNorthwind.Close
End Sub
Function QueryDefType(intType As Integer) As String
Select Case intType
Case dbQSelect
QueryDefType = "dbQSelect"
Case dbQAction
QueryDefType = "dbQAction"
Case dbQCrosstab
QueryDefType = "dbQCrosstab"
Case dbQDelete
QueryDefType = "dbQDelete"
Case dbQUpdate
QueryDefType = "dbQUpdate"
Case dbQAppend
QueryDefType = "dbQAppend"
Case dbQMakeTable
QueryDefType = "dbQMakeTable"
Case dbQDDL
QueryDefType = "dbQDDL"
Case dbQSQLPassThrough
QueryDefType = "dbQSQLPassThrough"
Case dbQSetOperation
QueryDefType = "dbQSetOperation"
Case dbQSPTBulk
QueryDefType = "dbQSPTBulk"
End Select
End Function
Example (Microsoft Access)
See the Size property example (Microsoft Access).
Example (Microsoft Excel)
See the Size property example (Microsoft Excel).