Solved

Form Fields tied to Autonumber in tables, instant generation?

Posted on 1998-05-04
4
667 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:cyberwarrior
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:cyberwarrior
ID: 1960994
Edited text of question
0
 
LVL 27

Accepted Solution

by:
aburr earned 200 total points
ID: 1960995
The autonumber increments only when you add a record to a table. Thus when you request info FROM the table with a form the autonumber does not change. The form can be cleared with no change to the table.
-
An additional thought. Why do you use an autonumber. it is usually used when a unique key cannot be otherwise establised from the data in the record. is that the case with you? If it is not you do not need auto number.
0
 

Author Comment

by:cyberwarrior
ID: 1960996
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.
0
 
LVL 27

Expert Comment

by:aburr
ID: 1960997
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question