Autonumbers and saving records

Cgrnc

Registered User.
Local time
Today, 03:30
Joined
Nov 7, 2000
Messages
15
I have used autonumbers in most of my tables as primary keys. I have a form that has four text boxes and three subforms on it. The first text box holds the primary key and is not visible to the user. The other three text boxes have defaults in them (the user can change if needed). My problem:

If the user uses the mouse to click on a subform expecting to accept all of the defaults they get an error message stating that the primary key cannot be null. This is because the autonumber as well as all of the defaults aren't saved to the tables unless one of the fields is typed in or one of the fields is tabbed out of or "entered" using the enter key! Help!

Is there a way to get these fields to save by clicking on one of the subforms? I tried DoCmd.Save in several different places (Event code for leaving fields, AfterUpdate, BeforeUpdate, OnFocus, LostFocus . . . you name it)!!

Thanks up front for any responses!!
 
Save a subform recordset when OnEnter fires with the very first object in the subform. You may have to also delete this record (via VBA) if the user clicks a Cancel button or doesn't otherwise want this record etc.

The record is then saved again when fully edited/updated - probably by a button, or tabbing off the record.
 
How would I go about saving a recordset? Could I save a recordset for the Parent form? This is the form with the default problem.
Thanks!
 

Users who are viewing this thread

Back
Top Bottom