What is the best way to implement a control buttons that would allow the operator to move to "Next" record in a bound form?

I would like to create a button that allows the operator to skip to the next record in a bound form. The recordsource for the form is a query. When I click "Next", it triggers the btnNext_Click event, where I used VBA to code

If Me.Dirty Then
        Me.Undo
End If
docmd.gotorecord , , acnext

I get error messages telling me that docmd.gotorecord ,, acNext cannot be executed unless the form is a Continuous form. My form is a Single form. Do I have to make the form unbound and provide all my own opens, loads, record navigations, etc using DAO?  Or is there a simpler way around this problem?

I would prefer to let ACCESS handle all aspects of the form and record manipulation, except my application requires a "Next" button that will Undo any changes to the current record (if dirty) then move to the next record in the query's dataset.
SowleManRetiredAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mbizupCommented:
<<DoCmd.GoToRecord , , acNext>>

This command *should* work, and DOES work for me in single form view.

Try creating the button again, from scratch with no extra code.  Btw, you can use Access's control wizard to do this when the popup appears after placing the new button, select 'Record Navigation' for the category, and 'Go to Next Record' as the action).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PatHartmanCommented:
After the wizard creates the event code, you can use the convert to VBA button to convert it from an embedded macro to VBA.  Then you can add your code at the top of the procedure.

I am always reluctant to simply back out a user's changes without warning.  I would suggest that you don't allow changes at all.  Then you can have a button that puts the form in edit view to allow editing if you need to allow edits but don't want to let them happen accidentally.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.