ADO Value Property

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO Value Property

The Value property sets or returns the value of a Parameter, Field, or Property object.

Object

Description of the Value Property

Parameter The Value property sets or returns a variant that indicates the value of the Parameter object

Note: The Recordset should be closed before you try to read the Value property. ADO can only read the Value property once from the provider

Field The Value property sets or returns a variant that indicates the current value of the Field object

Note: For a new Field object that are added to the Fields collection of a Record, you must first set the Value property and perform an update before you can set any other property

Property The Value property sets or returns a variant that indicates the current value of the Property object

Note: You cannot set the Value for properties that are read-only

Syntax

objectname.Value

Example

For a Field object:
set conn=New ADODB.Connection
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "F:\MaterialMaster\Material_Master.mdb"
set rs = New ADODB.Recordset
rs.Open "SELECT * FROM tblAMSEA", conn

debug.print(rs.Fields(0).Value)
rs.Close
conn.close
set rs=nothing
set conn=nothing
 
For a Parameter object:
set comm=New ADODB.Command
set para=New ADODB.Parameter
para.Type=adVarChar
para.Size=25
para.Direction=adParamInput
para.Value=varfname
comm.Parameters.Append para
 
For a Property object:
set conn=New ADODB.Connection
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "F:\MaterialMaster\Material_Master.mdb"
set rs = New ADODB.Recordset
rs.open "SELECT * FROM tblAMSEA", conn
set prop=New ADODB.Property
'Display the property attributes of the Orders Table
For each prop in rs.Properties
  debug.print "Attr:" & prop.Attributes & VbCrLf
  debug.print "Name:" & prop.Name & VbCrLf
  debug.print "Value:" & prop.Value
Next
rs.close
conn.close
set rs=nothing
set conn=nothing