Strange behavior

sven2

Registered User.
Local time
Today, 21:35
Joined
Apr 28, 2007
Messages
297
Hello,

I have the following the problem:

when I use an unbound form with ADODB and I make 2 buttons (next and previous record) with the code below:

cmd nextrecord ()

On Error GoTo Err_cmdvolgende
rst.MoveNext
showrecords
Exit Sub

Err_cmdvolgende:
MsgBox "This is the last record!", vbInformation, MT
Resume Next

cmdprevious record ()

On Error GoTo Err_cmdvolgende
rst.MovePrevious
showrecords
Exit Sub

Err_cmdvolgende:
MsgBox "This is the first record!", vbInformation, MT
Resume Next

The result is that when I get the message this is the last record I have to click twice on the button cmdpreviousrecord to go to the previous record.

For example
I open the form and click on the button previous record. I get the message "this is the first record". So far so good. But when I click the button nextrecord nothing happens. I click the button again and I see the next record.

How can I solve this problem?

Thanks in advance,
Sven.
 

Users who are viewing this thread

Back
Top Bottom