Command Button Wizard - Record Navigation - Go to next record

M

Mark909

Ive created two command buttons to go through records in my form.

However when it gets to the ends of the records a box pops up saying "You
can't go to the specified record"

Is there anyway to makes this stop?

I just want the buttons to work like the record controls in the bottom left
hand corner of the screen
 
M

MikeJohnB

You can always remove the error event

Private Sub Command15_Click()
On Error GoTo Err_Command15_Click


DoCmd.GoToRecord , , acNext

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
'MsgBox Err.Description (Note Commented Out with')
Resume Exit_Command15_Click

End Sub

Above I have commented out the MsgBox description with apostrophy

This will skip the error message but allow the sub to exit

Personnaly I normally leave the error message in though.

There are other ways but the above is the simplest depending on which
version of Access you are running (This is Access 2003 and prior) I think
A2007 uses embeded macros which I am not yet conversant with. You will need
to do it for each search button.
 

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