G
Guest
I am trying to have a seq# starting at 64 then increaseing by one each time I
add a new record is there a way to do this?
add a new record is there a way to do this?
I am trying to have a seq# starting at 64 then increaseing by one each time I
add a new record is there a way to do this?
John Vinson said:I am trying to have a seq# starting at 64 then increaseing by one each time I
add a new record is there a way to do this?
Use a Long Integer field in your table (don't use the # character in
the name though, it's a date delimiter and may cause trouble in the
future).
You MUST - no option! - use a Form to add data to the table; table
datasheets don't have any usable events.
In the Form's BeforeInsert event, click the ... icon, invoke the Code
Builder, and edit it to
Private Sub Form_BeforeInsert(Cancel as Integer)
Me![txtSeq] = NZ(DMax("[Seq]", "[yourtablename]"), 63) + 1
End Sub
This will put 64 into the table for the first record added, and
increment the highest existing value by one for each subsequent
record.
John W. Vinson[MVP]
John,
How about if you want the next record to automatically increment one quarter
(3 months)?
John,
That worked great!!! Thanks.
Just one small thing... when you advance to the next record, the date
advances, but you have to edit the date to get the next record to advance.
What can I change about the code to get the cell to advance when a different
field is used as an AfterUpdate?