Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Blank records question

Posted on 2003-11-18
8
Medium Priority
?
283 Views
Last Modified: 2012-08-14
I am using "DoCmd.RunCommand acCmdUndo"  on a button that closes my form to prevent blank or incomplete records from being added.  The only problem I have is my UID is AutoNumbered, and everytime this button is pressed a UID gets deleted (ex. if users start to enter a record, then press the "Close Form", blank record does not get saved - GOOD - but the particular UID that would have been assigned to that record gets deleted - BAD - which throws the sequence off.  If, for instance, user completes record 23, starts to enter record 24 but does not complete it and instead closes the form, record 24 dissappears completely and next time user will start at record 25.)

Is there any particular way to combat this problem?  

Thanks in advance.  Please let me know if this needs further explaining.

IPT
0
Comment
Question by:iptrader
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 32

Accepted Solution

by:
jadedata earned 400 total points
ID: 9773566
Hey iptrader!

  This is a natural function of the AutoNumber and Undo,  once used and trashed, its gone...
  The only cure for this is to compact the database that the table is located in IMMEDIATELY after the autonumber gets trashed.  Access would "recycle" the numbers, re-beginning at the highest number in the current recordset.
  (this is normally NOT thought of as an acceptable solution,...)

  You could use an unbound form to put data into and only commit this data to the table if the user confirms that it is good to go.
  This would prevent the Creation/Trashing of the autonumbers as only good records would be put into the table.
 
Questions?
 
regards
Jack
0
 
LVL 39

Assisted Solution

by:stevbe
stevbe earned 400 total points
ID: 9773606
As you have found out, Autonumber really was never intended to be seen by or have much value for end users but is useful as an artificial PK (please don't get started Jack started :-). If you really need a sequential number you are better off writing a custom function to generate it rather than trying to use Autonumber for this purpose.

Steve
0
 
LVL 23

Expert Comment

by:heer2351
ID: 9773619
An autonumber field should *never* have a meaning, it should only be used to uniquely identify a record. Your problem is just an example of why an autonumber field should not have a meaning.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:iptrader
ID: 9773642
The UID is not seen by the users, it is only used for my purposes.  It's more of an annoyance than anything else.

IPT
0
 
LVL 23

Assisted Solution

by:heer2351
heer2351 earned 400 total points
ID: 9773658
Sorry Steve did not see your comment before I posted but as you can see I fully agree with your comment. BTW JDettman made an excellent function for this purpose, see:

http://www.experts-exchange.com/Databases/MS_Access/Q_20092292.html
0
 
LVL 32

Expert Comment

by:jadedata
ID: 9773670
I'd say let it be then...  The element has no value other than possibly retrieving a specific record later using this id to find it.
0
 

Author Comment

by:iptrader
ID: 9773735
Thank you for your comments!  Jack, I think I'll take your suggestion, it is becoming more trouble than it's worth.

Best to all,

IPT
0
 
LVL 32

Expert Comment

by:jadedata
ID: 9773775
Thanx for the question!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

722 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