Navigation buttons adding new records

R

Rose B

I have a form based upon a table. I have found that if I show the (system)
navigation buttons at the bottom and use them to go through the record set,
once I go beyond the last record it just keeps adding new records. How can I
stop this?

(I have looked at another database, built elsewhere, that has a similar form
but as soon as you go one past the last record it greys out the next record
arrow and if you do not enter any data does not add a record to the
underlying table. I have checked all of the properties of the form and cannot
find any difference).

I have also looked at replacing the navigation arrows with my own and based
the selection upon record number (the table key), but as I want to sort the
records this is not really very helpful.

Any suggestions very much appreciated! (Hopefully this is some really simple
and obvious setting that I am just missing).
 
A

Arvin Meyer [MVP]

Open the form in Design View. Go to the Data tab on the property sheet, and
turn off Allow Additions. The will prohibit the behavior that you want to
stop.
 
R

Rose B

I do want the user to be able to add new records though...... just that I
want them to actually add information and not just blank records by
inadvertently continually clicking the next record arrow. (My 'reference'
database allows this and has the Allow Addition turned on - so am guessing
that there must be another 'switch' somewhere? In this database, the user
clicks the next record arrow and it will only go one record beyond the
current last record until they actually start entering some data.)
 
R

Rose B

Could it be anything to do with the fact that the form has a sub-form? (The
subform does not seem to add records in the same way that the main form does).
 
R

Rick Brandt

Rose said:
I have a form based upon a table. I have found that if I show the
(system) navigation buttons at the bottom and use them to go through
the record set, once I go beyond the last record it just keeps adding
new records. How can I stop this?

(I have looked at another database, built elsewhere, that has a
similar form but as soon as you go one past the last record it greys
out the next record arrow and if you do not enter any data does not
add a record to the underlying table. I have checked all of the
properties of the form and cannot find any difference).

I have also looked at replacing the navigation arrows with my own and
based the selection upon record number (the table key), but as I want
to sort the records this is not really very helpful.

Any suggestions very much appreciated! (Hopefully this is some really
simple and obvious setting that I am just missing).

Somewhere you have code or a macro that is setting a value. At least one
value on the form has to be set for a record to be created. Simply
navigating will not do so.
 
R

Rose B

I have not found any code or any macro at all that is doing this - there are
some defaults set but will keep looking. Meanwhile I have changed the opne
event to set AllowAdditions to False on the form, and then added a new button
to add new records which then sets AllowAdditions to True, creates new record
and then sets to False again.

Still wondering whether the subform is doing it, so will carry out some
further investigations when I have time - but at least the problem is 'fixed'
as far as the user is concerned. Thanks for your prompt responses (Rick and
Arvin).
 
W

wade polk

Thanks, that helped for a similar problem of mine. I have setup my own navigation buttons and disabled the sys nav buttons. I only want the user to be able to cycle through "SAVED" records. New records are entered on a different form. So, Now it works as I want except when the user cycles to the last or first record and then one more, he/she gets the error "you can't go to the specified record". Is there any way to disable this notice so nothing happens on the "one more over" or, alternatively, cycles in a loop back to the first/last?

Thanks.
 
F

fredg

Thanks, that helped for a similar problem of mine. I have setup my
own navigation buttons and disabled the sys nav buttons. I only
want the user to be able to cycle through "SAVED" records. New
records are entered on a different form. So, Now it works as I want
except when the user cycles to the last or first record and then
one more, he/she gets the error "you can't go to the specified
record". Is there any way to disable this notice so nothing happens
on the "one more over" or, alternatively, cycles in a loop back to
the first/last?

Thanks.

Code the button that goes to the Next record:

DoCmd.GoToRecord , , acNext

Code the button that goes Back one record:

DoCmd.GoToRecord , , acPrevious

Code the Form's Current event:

CmdPreviousRecord.Enabled = Not Me.CurrentRecord = 1
CmdNextRecord.Enabled = Me.CurrentRecord = 1 Or Me.CurrentRecord <
Me.Recordset.RecordCount

The Next button will be grayed out when you reach the last record.
The Back button will be grayed out when you are at the first record.

Change CmdPreviousRecord and CmdNextRecord to whatever the actual
names of your command buttons are.
 

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