Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordnumber in the goto record : error 1

Status
Not open for further replies.

griet

Programmer
Sep 8, 2001
21
BE
I do have following code

If KeyCode = 38 Then
'"UpArrow"
DoCmd.GoToRecord , , acPrevious, 1

ElseIf KeyCode = 40 Then
'"DownArrow"
DoCmd.GoToRecord , , acNext, 1

Of course there is an error when the cursor is standing on the first record and the "uparrow" key is pressed on.
Can I test the recordnr in the if-statement ?
 
On Error Goto ErrArrow

If KeyCode = 38 Then
'"UpArrow"
DoCmd.GoToRecord , , acPrevious, 1

ElseIf KeyCode = 40 Then
'"DownArrow"
DoCmd.GoToRecord , , acNext, 1

ErrArrow:
if err.number = (need the error number you get when it is uparrow. and place it here) Then
docmd.gotorecord,,acfirst
end if

if err.number = (need the error number you get when it is downarrow. and place it here) Then
docmd.gotorecord,,aclast
end if

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top