Solved

Replacing DAO data control Reposition event

Posted on 2003-12-10
5
384 Views
Last Modified: 2012-05-04
I am migrating an application from DAO to ADO.  One particluar form had a datacontrol_Reposition event.  I have replaced this with a datacontrol_MoveComplete event, but my problem is that it fires when I don't want it to.  The Repostion event only fired when navigating from one record to another.  I would like the MoveComplete event to work the same way.  I have tried to limit when the MoveComplete fires without any luck.  Can someone help?
0
Comment
Question by:PhilChandler
  • 2
5 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 10260677
Hi PhilChandler,
 This is what microsoft says about moving from DAO reposition to ADO reposition.....

Use the AbsolutePosition property to move to a record, based on its ordinal position in the Recordset object, or to determine the ordinal position of the current record. The provider must support the appropriate functionality for this property to be available.

AbsolutePosition is 1-based and equals 1 when the current record is the first record in the Recordset. As mentioned previously, you can obtain the total number of records in the Recordset object from the RecordCount property.

When you set the AbsolutePosition property, even if it is to a record in the current cache, ADO reloads the cache with a new group of records starting with the record you specified. The CacheSize property determines the size of this group.

Note   You should not use the AbsolutePosition property as a surrogate record number. The position of a given record changes when you delete a preceding record. There also is no assurance that a given record will have the same AbsolutePosition if the Recordset object is requeried or reopened. Bookmarks are the recommended way of retaining and returning to a given position and are the only way of positioning across all types of Recordset objects.

If you need more help let me know.



0
 
LVL 27

Expert Comment

by:planocz
ID: 10942495
PhilChandler did not response to my correct answer.
Split points planocz and  part refund
0
 

Author Comment

by:PhilChandler
ID: 10949731
I was able to solve my problem in the following way:
I added the following IF statement when entering the event to control when it would execute the rest of the code:

   If ((adReason = adRsnMoveFirst) Or (adReason = adRsnMoveNext) Or _
       (adReason = adRsnMovePrevious) Or (adReason = adRsnMoveLast)) Then

This allowed the rest of the code to be executed only when a move occurred.  I know that this is not how the event is supposed to work, however, we were upgrading from DAO to ADO technology and this was the quickest fix, without doing a complete rewrite.

AbsolutePosition had nothing to do with my problem or solution, but I thank you for taking the time to anwer planocz.
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 10971699
Closed, 500 points refunded.
PashaMod
Community Support Moderator
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now