table doesn't update until after I press the escape key
try removing the expression from the DefaultValue property of the SongID
field. instead, run the following code from the subform's BeforeUpdate
property, as
Me!SongID = Nz(DMax("SongID","MusicOnPC_Songs"),0)+1
if SongID is the primary key field of table MusicOnPC_Songs, it might be
easier to just set the field's data type as Autonumber and let Access do the
work instead.
hth
"Chip" wrote in message
...
I have a form with subform working but with one issue - when I enter data
into a row I start on the next row, but get error about duplicate key. I
press the escape key, it clears the data I just tried inputing, and it
updates the key field. The key field causing the error uses this in the
default value property field-
=Nz(DMax("SongID","MusicOnPC_Songs"),0)+1
Is there something missing to make it update after I tab out of the last
field for that row, and move into the next row?
|