Value property (Field)
Returns the value assigned to a Field object retrieved from a record set. The value is not set for fields within a DataSet object. Read-only Variant.
Applies to
Objects: Field
Syntax
object.Value
Parameters
Part | Description |
---|---|
object | Required. An expression that returns a Field object. |
Remarks
The Value property is the default property for the Field object.
To return the data type of a field, use the Type property of the Field object.
Example
Sub GetDataSetValues()
'Write all the values from a data set to a tab-delimited file
Dim objApp As New MapPoint.Application
Dim objDataSet As MapPoint.DataSet
Dim objRS As MapPoint.Recordset
Dim objFld As MapPoint.Field
Dim strVals As String
Dim iFile As Integer
'Open an existing data set
Set objDataSet = objApp.OpenMap(objApp.Path & "\Samples\Sales.ptm").DataSets("SampleData")
'Query to obtain a record set with all the records
Set objRS = objDataSet.QueryAllRecords
'Open the file
iFile = FreeFile
Open "SalesData.tab" For Output As #iFile
'Write the column names
For Each objFld In objDataSet.Fields
strVals = strVals & objFld.Name & vbTab
Next objFld
Print #iFile, strVals
'Loop through all the records (if any)
Do Until objRS.EOF
'Write the column values
strVals = ""
For Each objFld In objRS.Fields
strVals = strVals & CStr(objFld.Value) & vbTab
Next objFld
Print #iFile, strVals
'Move to the next record (or to EOF)
objRS.MoveNext
Loop
'Close the file and display it
Close #iFile
Shell "notepad SalesData.tab"
End Sub