Question about Next Record_ID (AutoNumber)

jlathem

Registered User.
Local time
Today, 15:14
Joined
Jul 25, 2010
Messages
201
Is there a way to see the Next Record_ID (AutoNumber) if there are no records in the table?

I have a form that doesn’t submit until the user clicks a submit button. One control in the form requires a combined value of the date and the Record_ID and I need a record to start the process otherwise I would just DMax and add 1.

I don’t trust any of the users with knowledge of getting to the tables and mucking about trying to delete a dummy record used to start the numbering and I will not be in site to do it.

Anyone have a simple suggestion?

Thanks in advance for any ideas!

James
 
Is there a way to see the Next Record_ID (AutoNumber) if there are no records in the table?

I have a form that doesn’t submit until the user clicks a submit button. One control in the form requires a combined value of the date and the Record_ID and I need a record to start the process otherwise I would just DMax and add 1.

I don’t trust any of the users with knowledge of getting to the tables and mucking about trying to delete a dummy record used to start the numbering and I will not be in site to do it.

Anyone have a simple suggestion?

Thanks in advance for any ideas!

James

In Create a button on the form labelled "Get Record Number" that On Click does this:
Code:
Dim NextRecord
NextRecord = Me.Recordset.RecordCount + 1
msgbox "The Record Number is " & nextrecord
If multi-user however, I would put some code into the save button that automatically adds this data on save (to avoid numerous people getting the same record number!)

SGA
 
You may already have heard this, but it is worth repeating. The built in autonumber function should not be relied upon to do anything other than provide each record with a unique primary key. It is possible to have breaks in the sequence and it is even possible under certain circumstances to get negative numbers.

If you need to guarantee a sequential, positive, number create you own numbering protocol using the Dmax() functions. You will find much discussion on this topic and many example to boot.
 
but why would you need a field with both the date and the record id. just store the date separately from the ID

if these are seperate fields, there is no reason to duplicate the information (and denormalise into the bargain)
 

Users who are viewing this thread

Back
Top Bottom