Jump: Search:

Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access 2007/2010 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2010 (32 bit), 2007, 2003, 2002, 2000, and
Visual Basic 6.0!

Also available for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

 

 
Royalty free source code library modules for Microsoft Access, VB6, VBA, OfficeRoyalty free source code library modules for Microsoft Access, VB6, VBA, OfficeVBA and VB6 Source Code Library Download the free trial version of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA
Category: Database : Access/Jet
Description: Microsoft Access Jet databases and their objects (MDB and ACCDB database formats)

Class: CJetRecordset

Working with Microsoft Jet recordsets with DAO

With this class you can open and close recordsets on a variety of data sources, and get advanced information about records and fields.

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CJetRecordset class
Consistent Property Sets the class recordset's Consistent setting Consistent recordsets only allow proper updates on multi-table joins. Set this property to True to allow only proper updates. Set to False to allow inconsistent updates. For more information, search DAO online help for "OpenRecordset".
Database Property Gets a handle to the current open database Use this property to tell the class which Database object you want to use. You must first open the Database object in your code, and then pass it to this class. The Database property also returns the DAO Database object of the database the class currently has open. This allows you to gain access to any of the properties and methods available for the database object that refers to the currently open database. If you close the Database object in your code, the objects in this class are no longer valid. For this reason, close any instances of this class before closing your Database object.
DataSource Property Sets the data source for subsequent calls to the OpenRst method. Valid values are the name of a table or query in the database, or a valid Jet SQL string. For more information on what the Jet engine accepts for this property, search DAO online help for Openrecordset and look for the Source parameter.
FullyUpdatable Property Determines if the recordset and all its all fields are updatable. The Updateable property of a DAO recordset only determines if the recordset itself is updateable, not each field. This property checks the recordset itself, and all of its fields. Non-updateable recordsets are caused by many conditions such as joins in dynasets that restrict changes, or permissions settings that disallow editing.
LockType Property Gets the type of locking on the recordset Microsoft Jet supports several types of locking styles. Set this property the desired locking type to be used by the next OpenRst method call. The types of locking currently supported are: - cjrLockTypePessimistic: Use pessimistic locking. This style attempts to lock the record upon entering edit mode. If a lock cannot be obtained, the edit fails. This is the default mode of the class. - cjrLockTypeOptimistic : Use optimistic locking. With this type of locking, a lock is only placed when the record is updated. - cjrLockTypeReadOnly : Open as read only with no locks. For more information, search DAO online help for "OpenRecordset" method and see the "LockEdits" parameter.
PercentPosition Property Gets the position through the recordset. This property is better than the standard DAO PercentPosition property because it is always accurate with dynaset-type recordsets. On dynasets, the standard DAO version only shows the percentage of records that already have been visited. This version uses the same technique as the class's RecordCount property: it visits all records on dynasets before returning the value.
ReadOnly Property Sets the read-only state of the recordset For more information, search DAO online help for "OpenRecordset" and look for the Options parameter.
RecordCount Property Gets the count of records in the recordset. The technique to do this depends on the type of recordset the class currently has open. The RecordCount property for a Table type recordset reflects the total number of records in the table. This may not be accurate in multi-user environments when transactions have been aborted. To solve this problem, close and compact the database to get accurate counts. For dynaset and recordset types, the RecordCount property reflects only the number of recordset that have been visited. To get a count, the code needs to move to the last record. Before moving, the code saves the current position in the recordset using the Bookmark property.
RecordNumber Property Gets a pseudo-record number using the AbsolutePosition property. Note that the concept of a record number has little validity in set-oriented relational databases. This number should be used for display purposes only. Never rely on the value of a record number for navigation purposes.
Recordset Property Gets the current recordset object. This property is read-only. To set the class recordset, use the class OpenRst method.
RecordsetType Property Gets the type of the current recordset. Set this property before calling the OpenRst method. If you do not specify a specific type, Microsoft Jet will open whatever type of recordset it considers to be the most efficient for the data source you have specified. For more information on recordset types, search DAO online help for "OpenRecordset".
RecordSizeInBytes Property Gets an approximation of size, in bytes, of a record in the recordset by determining the amount of storage for each field. This number is approximate because the storage used for memo and long binary fields is variable. Additionally, even though Boolean fields (yes/no) only use one bit of storage, this property returns its value in bytes, so each boolean field is considered as one byte. This value does not include the actual storage space used by memo and long binary fields.
BuildOptions Private Calculates the value for the m_lngRecordsetOptions variable according the settings of the m_fOption... varaibles. This private internal method takes all class properties related to Recordset options and converts them to a long integer bitmask used by the DAO OpenRecordset method. For more information on the bitmask, search DAO online help for OpenRecordset and look at the Options argument.
Class_Initialize Initialize Set initial values to defaults which may be overridden with property settings
CloneRecordset Method Returns a clone of the current recordset. Note that this recordset should be a different object from the recordset object originally opened with this class.
CloseRst Method Closes the current recordset If the recordset was opened outside of the class and subsequently passed to this class, then this method does not close the recordset.
GotoLastModified Method Moves to the record that was last changed or added. Use the LastModified property with table- and dynaset-type Recordset objects. A record must be added or modified in the Recordset object itself in order for the LastModified property to have a value.
OpenRst Method Opens a recordset with the specified options To set the attributes for the recordset, set the appropriate properties for this class before calling this method.
RecordsetFieldsToArray Method Populates an array with a list of fields in the current recordset
RestoreBookmark Method Restores the recordset to the position saved by the SetBookmark method. Use the SetBookmark method to save a bookmark at the current recordset position. Then you can use the RestoreBookmark method to return to that position.
SetBookmark Method Sets a bookmark to the current position in the recordset. You can then use the RestoreBookmark method to restore to that position. Use the SetBookmark method to save a bookmark at the current recordset position. Then you can use the RestoreBookmark method to return to that position This method uses the DAO BookMark property. Not all recordsets support bookmarks, so this method may not be available. For example, if a recordset is not based entirely on data sources that support unique bookmarks, the entire recordset does not support bookmarks.

Overview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © FMS, Inc., Vienna, Virginia
Celebrating our 26th Year of Software Excellence