Help an idiot . . . Autonumbers (again) (1 Viewer)

Cgrnc

Registered User.
Local time
Today, 21:42
Joined
Nov 7, 2000
Messages
15
I posted this problem once and got one reply (that I didn't quite follow) under the subject: Autonumber and saving records.

Once again: I used autonumbers as primary keys in my tables. I have a Parent form with three text boxes and three subforms. The textboxes all have defaults in them at the form level. If one is using only the mouse and wishes to accept the defaults, clicking on one of the subforms produces the "Primary key is null" message because the record has not been saved.

How can I get the current record to save the defaults WITHOUT tabbing off the record or entering one of the text boxes?

In the reply to my first posting someone suggested saving a recordset for one of the subforms. . . how do I go about this?

Thanks (again) for any responses!!!!
 

yahazim

Registered User.
Local time
Today, 21:42
Joined
Apr 2, 2001
Messages
24
ALL RIGHT. This worked for me, and of course very simple once figured out.

Try Refreshing the form OnActivate.

--------------
Private Sub Form_Activate()
Me.Refresh

End Sub
--------------

Jim
 

Cgrnc

Registered User.
Local time
Today, 21:42
Joined
Nov 7, 2000
Messages
15
This didn't work for me but THANKS SO MUCH for the reply!!

Any other ideas?????
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:42
Joined
Feb 19, 2002
Messages
43,298
I'm not sure what the point is of saving a record that contains only default values. Surely there is something that should be entered. The command to save the current record is:

DoCmd.RunCommand acCmdSaveRecord

I'm not sure where you would put this since there is no event that will be triggered if someone wishes to just accept the defaults. Perhaps you should add a SAVE button to the form and put the record save command in the on click event of the button.
 

Cgrnc

Registered User.
Local time
Today, 21:42
Joined
Nov 7, 2000
Messages
15
Right you are!!! Thanks for the suggestions. I've got difficult users who want what they cannot have . . . I'll just have to learn to says so!!!
 

Users who are viewing this thread

Top Bottom