Hitting the Next Record button creates a new job instead of stopping

Modify_inc

Registered User.
Local time
Today, 05:50
Joined
Mar 25, 2013
Messages
20
I created a basic database in Access 2013 to keep up with jobs, and each job has a job number assigned to make each job unique (Primary Key).

At first I had it where I had to enter the new job number manually for each job. I have updated it and now it takes the last job number and adds 1 to it and then fills in the Job Number field automatically.

The problem is when I clicked the Last Record button, it will go to the last existing record, but if I click the Next Record button while on the last record, it will create a new record. It creates a new job instead of stopping at the last record. I assume it has to do with the auto numbering I have setup for the job numbers, since it didn't do this before, but I am not sure why. I ONLY want to be able to click the New Record (Blank) button to create a new job, NOT by also clicking the Next Record button.

Is there a way to force only the New Record button to add a new record? I still need the Previous and Next Record buttons to maneuver through the existing records. I just don't want to create new jobs accidentally by clicking the Next Record button when I'm at the end of the existing records. It should just stop, or say last record or something similar.

Thank you
Mike
 
Form (system) navigation buttons handle this for you. There's a whole family of code for programmatically navigating records. That code is commonly used with unbound forms. Search for either. Alternatively, use the system navigation buttons, not yours.

When positioned at the last record, you should disable your "next record" button.
 
Form (system) navigation buttons handle this for you.

No they don't. The Next button will go to the new record if you are at the last record.

[
When positioned at the last record, you should disable your "next record" button.

That is what the poster wants to know how to do. Repeating the question isn't particularly helpful.

Now to answer the question:

The reason the behaviour has changed is your code to increment the number. You could change it to determine if the new record has any data before it assignes the next number.

A better way is to suprsss the NewRecord by changing the Form's AllowNew property to No. You can have a button to change this to Yes when you want to add a new record. The AfterUpdate can be used to change it back to No.

AFAIK there is no way to change the behaviour of the built in form navigation buttons. They are not very good anyway so most developers hide them and make their own navigation buttons where they can control what they do.
 
No they don't. The Next button will go to the new record if you are at the last record.

[

That is what the poster wants to know how to do. Repeating the question isn't particularly helpful.

Now to answer the question:

The reason the behaviour has changed is your code to increment the number. You could change it to determine if the new record has any data before it assignes the next number.

A better way is to suprsss the NewRecord by changing the Form's AllowNew property to No. You can have a button to change this to Yes when you want to add a new record. The AfterUpdate can be used to change it back to No.

AFAIK there is no way to change the behaviour of the built in form navigation buttons. They are not very good anyway so most developers hide them and make their own navigation buttons where they can control what they do.

Thank you for the reply, I will change my code accordingly.
 

Users who are viewing this thread

Back
Top Bottom