Hello -
I'm looking for detailed information (event structures/orders/variables) surrounding autonumber and record update events.
Specifically, I have a form for adding new records to a table. Some of the fields are linked to other tables (displayed in combo-boxes). If a user tries to enter data in one of those fields that isn't in the underlying table, I give them the option to add it. This works by opening another data entry form for the appropriate table, taking the value entered by the user and passing it to the new form and setting that as the default value of the appropriate field (not the actual value). This is deliberate, so that if the user decides not to add the record and immediately escapes the form, the autonumber is not wasted. Setting the default value does not cause a new autonumber to be generated.
Let's assume that there are only two fields in the underlying table: an autonumber primary key and a description field. So, the data entry form is open and the default value of the description field is set to the value the user tried to enter in the previous form, and that field has the focus. The autonumber field has not incremented - it says [Autonumber].
Now, the problem occurs when I tab or enter out of the description field - the form doesn't "take" the default value. Focus just moves to the autonumber field. Hit enter again and it moves back to the description field.
What needs to happen to trigger the autonumber to increment? I would expect that as soon as I left the description field, Access would generate the autonumber - but it doesn't happen.
Anyone know the events underlying the autonumber field - and perhaps how they mesh with when a record is actually "created" and "added" to the table? Are there any usable variables associated with autonumber? Where's it stored, etc.?
Thanks,
John
I'm looking for detailed information (event structures/orders/variables) surrounding autonumber and record update events.
Specifically, I have a form for adding new records to a table. Some of the fields are linked to other tables (displayed in combo-boxes). If a user tries to enter data in one of those fields that isn't in the underlying table, I give them the option to add it. This works by opening another data entry form for the appropriate table, taking the value entered by the user and passing it to the new form and setting that as the default value of the appropriate field (not the actual value). This is deliberate, so that if the user decides not to add the record and immediately escapes the form, the autonumber is not wasted. Setting the default value does not cause a new autonumber to be generated.
Let's assume that there are only two fields in the underlying table: an autonumber primary key and a description field. So, the data entry form is open and the default value of the description field is set to the value the user tried to enter in the previous form, and that field has the focus. The autonumber field has not incremented - it says [Autonumber].
Now, the problem occurs when I tab or enter out of the description field - the form doesn't "take" the default value. Focus just moves to the autonumber field. Hit enter again and it moves back to the description field.
What needs to happen to trigger the autonumber to increment? I would expect that as soon as I left the description field, Access would generate the autonumber - but it doesn't happen.
Anyone know the events underlying the autonumber field - and perhaps how they mesh with when a record is actually "created" and "added" to the table? Are there any usable variables associated with autonumber? Where's it stored, etc.?
Thanks,
John