Link to home
Start Free TrialLog in
Avatar of cyberwarrior
cyberwarrior

asked on

Form Fields tied to Autonumber in tables, instant generation?

With a relational database and referential integrity enforced, a form can reference data from more than one table.  If these tables have an Autonumber as primary key, it seems that as soon as one field from that table is entered on the form, an Autonumber generates.  Thus, if I want to clear the form, I have already used one of the numbers in sequence.  Is there a way to unbound the form or do I need to unbind each field individually?  Should I change the primary key to an integer and increment it by one myself with VBA?  Summarily, how can I make the form save the data only when I advance to the next screen or press a save button?
Avatar of cyberwarrior
cyberwarrior

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of aburr
aburr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is a data entry form.  I am trying to develop this so that the user can change their mind and clear the data they have entered on the form.  The way it stands now, as soon as they enter the data corresponding to one of the tables, the autonumber is generated for that table.
The autonumber is designed to provide a foolproof unique identifyer for a record, hence it is difficult to fool with it.

For a table that contains records, you can use this procedure to change the next value assigned in an AutoNumber field to a new number.

1      Create a temporary table with just one field, a Number field; set its FieldSize property to Long Integer and give it the same name as the AutoNumber field in the table whose value you want to change.

How?

2      In Datasheet view, enter a value in the Number field of the temporary table that is 1 less than the starting value you want for the AutoNumber field. For example, if you want the AutoNumber field to start at 100, enter 99 in the Number field.
3      Create and run an append query to append the temporary table to the table whose AutoNumber value you want to change.

How?

Note   If your original table has a primary key, you must temporarily remove the primary key before running the append query. Also, if your original table contains fields that have the Required property set to Yes, the Indexed property set to Yes (No Duplicates), or field and/or record ValidationRule property settings that prevent Null entries in fields, you must temporarily disable these settings.

4      Delete the temporary table.
5      Delete the record added by the append query.
6      If you had to disable property settings in step 3, return them to their original settings.

When you enter a record in the remaining table, Microsoft Access uses an AutoNumber field value 1 greater than the value you entered in the temporary table.

Another possibility is to have your form dump its data into an append querry. when the data is satisfactory to the inputter then append the records.