Discussion Locked

Differentiate ADODC.MoveNext source?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do i know the ADODC.Recordset.MoveNext is fired from the my code ie:

if ADODC.Recordset("RefNo").Value <> 0 then
ADODC.Recordset.MoveNext

OR it is fired from the event where user has actually pressed the Next button in ADODC?

3 replies

by sl-campbell

Use the event: ADODC_MoveComplete

In the code window click on the left DropDown and select the name of your datacontrol, and in the right DropDown select MoveComplete.
The ADODB.EventReasonEnum returns adRsnMoveNext (value 13) in the variable adReason to identify that the action was MoveNext and the ADODB.EventStatusEnum returns adStatusOK (value 1) in the variable adStatus if the move was successful.

You could also do this by comparing the AbsolutePosition property:

Dim lPrevPos As Long
if ADODC.Recordset("RefNo").Value <> 0 then
lPrevPos = ADODC.Recordset.AbsolutePosition
ADODC.Recordset.MoveNext
if ADODC.Recordset.AbsolutePosition <>lPrevPos then
'repositioned - new record
End If

by ohjani

i know how to do a MoveNext, but i want to differentiate whether the MoveNext event is triggered from my code (ie: ADODC.Recordset.MoveNext) or the event is triggered from the action from user (ie: pressed the MoveNext button on the datacontrol)

This discussion is closed to new replies.