ADO OriginalValue and UnderlyingValue Properties

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

ADO OriginalValue and UnderlyingValue Properties

The OriginalValue property returns a variant that contains the field value as it existed right after the last Update or UpdateBatch method call.

The UnderlyingValue property returns a variant that contains the current value of a field. This value does not necessarily show changes made by other users and may not be the latest value.

Tip: Use the Resync property of the Recordset object to get the latest values for all of the Field objects in the Fields Collection.

Tip: These properties can be used together to prevent update conflicts.

Syntax

objField.OriginalValue
objField.UnderlyingValue

Example

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 "tblAMSEA", conn
set objfield=rs.fields("StandardCost")
'some code........
'check for changes
rs.movefirst
while rs.eof=false
  if objfield.OriginalValue<>objfield.UnderlyingValue then
    debug.print "Data has changed!" & VbCrLf
    debug.print "Original value: "
    debug.print objfield.OriginalValue & VbCrLf
    debug.print "Current value: "
    debug.print objfield.UnderlyingValue & VbCrLf
  end if
  rs.movenext
next
rs.Close
conn.close