Custom AutoNumber

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Hello,
I need some help trying to create a custom autonumber. I want to
start at 1 and increment by 1 but I want the number to be preceded by
INT-. So the first record would be INT-1 the next record INT-2.
Thanks for any help!
 
I need some help trying to create a custom autonumber. I want to
start at 1 and increment by 1 but I want the number to be preceded by
INT-. So the first record would be INT-1 the next record INT-2.
Thanks for any help!

If the prefix will always be "INT-", then don't store it. Simply concatenate the
prefix to the autonumber field in a textbox wherever you need to display it. The
textbox's "Control Source" property would be:

="INT-" & [RecordID]

.... where "RecordID" is the name of your autonumber field.
 
Hello,
I need some help trying to create a custom autonumber. I want to
start at 1 and increment by 1 but I want the number to be preceded by
INT-. So the first record would be INT-1 the next record INT-2.
Thanks for any help!

If *every* value should have INT- displayed (and not any other text),
then it's by far the simplest not to store the INT- in the table at
all. Just use a Long Integer field and set its Format property to


"INT-#"

To increment the number, use a Form to enter your data (table
datasheets don't have any usable events); in its BeforeInsert event
put code like

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtINT = NZ(DMax("[INT]", "yourtable")) + 1
End Sub

(assuming the field is named INT and is displayed in a textbox named
txtINT).
 
Back
Top