Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Call this member function to retrieve data in a recordset.

virtual void GetFieldValue(
   LPCTSTR lpszName,
   COleVariant& varValue 
virtual void GetFieldValue(
   int nIndex,
   COleVariant& varValue 
virtual COleVariant GetFieldValue(
   LPCTSTR lpszName 
virtual COleVariant GetFieldValue(
   int nIndex 



A pointer to a string that contains the name of a field.


A reference to a COleVariant object that will store the value of a field.


A zero-based index of the field in the recordset's Fields collection, for lookup by index.

The two versions of GetFieldValue that return a value return a COleVariant object that contains the value of a field.

You can look up a field by name or by ordinal position.


It is more efficient to call one of the versions of this member function that takes a COleVariant object reference as a parameter, rather than calling a version that returns a COleVariant object. The latter versions of this function are kept for backward compatibility.

Use GetFieldValue and SetFieldValue to dynamically bind fields at run time rather than statically binding columns using the DoFieldExchange mechanism.

GetFieldValue and the DoFieldExchange mechanism can be combined to improve performance. For example, use GetFieldValue to retrieve a value that you need only on demand, and assign that call to a "More Information" button in the interface.

For related information, see the topics "Field Object" and "Value Property" in DAO Help.

Community Additions

© 2015 Microsoft