Can't trigger error message with docmd.gotorecord

S

Sue Powell

Hi

I have a form where I want to use my own navigation
buttons, next and previous. I ahve inserted these buttons
using the add button wizard.

when trying to move to a record that does not exist I get
the standard error message "run-time error"2105" you
can't go to the specified message"

I would like to replace this message with one of my own,
but this error doesn't trigger the on error goto action
to send the code to my own error handling.

I am using access 2002 with the database in access 2000
format.

Can anyone tell me how to trigger the error handling, or
is it not possible in this case.

Thanks

Sue Powell
 
D

Dale Fye

Sue,

You might want to consider disabling your navigation buttons that don't
apply. In the forms current event, you would need to test to determine
whether you are at the beginning or end of the recordset. This would
prevent you from having to trap for these errors, as well as being more user
friendly. You could also add some code next to the navigation buttions to
indicate which record the user is on (similiar to the regular Access
navigation bar). Something like:

Me.cmd_Next.Enabled = (Me.CurrentRecord < Me.RecordsetClone.RecordCount)
Me.cmd_Previous.Enabled = (Me.CurrentRecord > 1)
Me.lbl_Records.Caption = "Record " & me.currentrecord & " of " &
me.recordsetclone.recordcount

HTH
Dale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top