Records overwriting?

G

Guest

I have a command button that when clicked,
gives me the next sequential number.

I also have an event for the form, that when
the program is started from scratch,
the "RunNumber" gives me the next
sequential number.

I have a control named "RunNumber".
I noticed that if the program is closed,
then reopened, the database starts at
the 1st record.

The problem is that when the form is opened
from scratch, it records the next sequential number
over the 1st record. Is there a way for the form
to open on the next available record (giving me the next sequential number)
AND
is there a way to protect this data from being overwritten?

P.S. No Duplicates is not an option, Unless there is a way
to assign No Duplicates to one control, based on the value
of another control.

Thanks
Tom
 
G

Guest

Your question is rather vague and I'm not sure what you are trying to do.
I dont understand the need for the command button.
Does this table have an autonumber key?
If not, I recommend you use one and use this as the 'record number'. Just
make the control showing this number locked so it cannot be updated. You can
then use the standard form navigation buttons to navigate through your
records or go to a new record.

Dorian
 
L

Larry Daugherty

I recommend that you NOT use an autonumber for your sequence number if
it will be seen when your application runs.

So that you don't clobber an existing number when the form opens or is
current, make that calculated value the Default value for the textbox.
If there is nothing there it will get your number. If there already
was a number then the existing number is unaffected.

To answer another part of your question: Put a line of code in your
form's OnLoad Event to send it to a new record. acNewRec

HTH
 

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