Cursors in MS Access and ADO - CursorType changed to adOpenForwardOnly
(Page 4 of 4 )
If you change the CursorType property in the above code from being adOpenStatic to adOpenForwardOnly and try to run the application, you will end up with a run time error because going back is not permitted and the first time you try to do so (using MovePrevious), an error will be generated and you will get the following message:

Now if you try to debug, you will be guided to the highlighted line as shown.

Summary
In this tutorial we have seen some of the basic features of ADO's cursors as applied to data retrieved using a simple select statement on a table in the Northwind sample database. Not all OleDB providers provide all cursor types. This brings us to another important property not discussed, namely Recordset's Supports property which takes the property or method as an argument. Most importantly we have seen the different kinds of cursors that are used and two simple examples of how they change the functionality of retrieved data.
Record navigation was discussed in the context of cursors, although in addition to MovePrevious, MoveLast, and MoveNext there are also MoveFirst and Move (which takes two optional arguments, how many steps to move and starting from where). We will look at record navigation when bound to a form in another tutorial. When data changes are to be made using action queries the cursor location property becomes very important. The LockType and CacheSize properties were not discussed, but that will be rectified in a future tutorial.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |