I have Access 2003 and SQL Server. My adp has a main form with a tab control. On the second tab are two subforms, linked by the autonumber field of the main table.
When I add a new record using "DoCmd.GoToRecord , , acNewRec", it all appears ok at first. But when I begin to type a value into the first field (which is a datetime field using a Calendar8 control), I get an error in the Form_Current event of the subforms. The error reads as follows:
Run-time error '31004'
The value of an (Autonumber) field cannot be retrieved prior to being saved....
I've gotten around it as far as the users are concerned by putting in "On error resume next", but that's obviously a bandage, not a solution.
I've even tried a save immediately following the new record, but that didn't seem to make a difference.
What can I do to alleviate this problem?