E
Erin Lashbrook
I am trying to create a field in a table where the ID tag
is automatically generated when an entry is created.
The way I have it set up, you use a form linked to the
table "Journal" to create a new entry. WHen the new entry
is submitted, I want the date field (CreationDate) to post
with the current date, and the ID field (ID) to
automatically be one number after the previous entry in
the table.
I am using the following code, which I think should work,
but for some reason it won't add past 1:
----
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me![ID]) = True Then
Me![ID] = Nz(DMax("[ID]", "Journal", 0) + 1)
Me![CreationDate] = Now()
End If
End Sub
is automatically generated when an entry is created.
The way I have it set up, you use a form linked to the
table "Journal" to create a new entry. WHen the new entry
is submitted, I want the date field (CreationDate) to post
with the current date, and the ID field (ID) to
automatically be one number after the previous entry in
the table.
I am using the following code, which I think should work,
but for some reason it won't add past 1:
----
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me![ID]) = True Then
Me![ID] = Nz(DMax("[ID]", "Journal", 0) + 1)
Me![CreationDate] = Now()
End If
End Sub