Automatically insert record # into field

mrbebop

Registered User.
Local time
Today, 19:32
Joined
Jun 6, 2003
Messages
32
On my form I have a field that is using the record # as part of a lot # for our product. Presently a combo of letters and #s are manually typed in the field that I am speaking of. A lot of mistakes are being made and I would like to have the information to be put in automatically. I have changed the default value to take care of the first four places that will be entered but I would like the record # to be used as the last four places. I would like the total combination to take 8 places. Zeros are used to take the place of the missing #'s in the record digits. The field should look like this if this is the first record entered.
"AB030001" This is using the default value that I spoke of. Thank in advance for your help.
 
Look up input masks in the help within Access

try somethings like this in the properties of the control field:

set the imput mask e.g >"AB"000000
 
Last edited:
The concept of "record numbers" isn't used in Access. Records have various indices which determine their order when a table is displayed. An autonumber field is the closest thing analogous to a record number but only because the autonumber field can be indexed without duplicates and in which case the "records" can be easily displayed in the order created.

What do you mean by "record number' and where does the prefix come from?
 
Im assuming that he is not referring to a Autonumber. If it is, then thats another matter.
 
Last edited:
You are correct.

Please excuse my lack of knowledge. The lot number would be 1 + the number of records in the database. If there were 50 records in the database and a new record was entered the lot number would be ****0051. I hope this is more correct. Thanks for your help.
Robert
 
The Dcount function will allow you to count all of the records in a table.

DCount("*", "TableName")

What happens to the numbering scheme if a record is deleted?
 
I fell into that trap once ...

I would use the DMax (+ 1) function as that logic will work if
records are deleted.

DCount (+ 1) can actually return a value considerably smaller
than your largest key.

Wayne
 
Thanks everybody

Thank you, now hopefully I can implement your ideas!:)
 

Users who are viewing this thread

Back
Top Bottom