AutoNumber automatically generate on New Record?

  • Thread starter Thread starter Roger
  • Start date Start date
R

Roger

How can I make the Autonumber automatically gernerate a number when the New
record event happens?

Currently I am using Access 2003. It only generates if some part of the
record has data in any field.

I have a subform and people are gettting a new header record by hitting the
new record selector, then just typing in the sub form. Since the AutoNumber
has not generated a new number, the detail doesn't have any idea of how it
is related to the header.

Any suggestions?

Thanks,

Rog
 
Roger said:
How can I make the Autonumber automatically gernerate a number when
the New record event happens?

Currently I am using Access 2003. It only generates if some part of
the record has data in any field.

I have a subform and people are gettting a new header record by
hitting the new record selector, then just typing in the sub form.
Since the AutoNumber has not generated a new number, the detail
doesn't have any idea of how it is related to the header.

Any suggestions?

Either the user or your app has to make at least one entry on the main form
before they try to create a subform record. If your app does it by testing
for NewRecord = True in a code or macro then you will generate a parent
record EVERY time someone navigates to that position (not a good idea).
 
Well how do I go about doing this? What event happens when they enter a new
header record?

Any suggestions?

Roger
 
Roger said:
Well how do I go about doing this? What event happens when they
enter a new header record?

First explain your data structure. A form/subform where the only data in
the main form is an AutoNumber sounds pretty strange. Is that what you
have? If your parent has other fields that just have default values applied
then just remove the default on one of those and have the user enter it.
Another option is to hide the subform on a new record and provide a button
[Insert Records]. The code behind that button can dirty the parent record
by setting a value and also make the subform visible. Now when the user
enters the subform a proper parent record will exist.
 
Back
Top