From: Tara on
Ken, Keith & Arvin,

I can't thank you enough for all the help you provided below. I'll be working on this in the next day or two and may have additional posts to this one. For now you guys are my Hero's!

Tara



KenSheridan via AccessMonster.com wrote:

Of the approaches which have been suggested Roger Carlson's is simple
19-Jan-10

Of the approaches which have been suggested Roger Carlson's is simple and
reliable, but has the drawback that if there is a conflict the number is
incremented only when an attempt to save the record is made. This would seem
to go against your requirement that 'it needs to show the user the
Registration # they are currently working on'.

Keith's approach overcomes this by saving the new record immediately before
other data is entered, but this means that Nulls cannot be disallowed in the
non-key fields by setting their Required property to True, unless each is
also given a DefaultValue property, so this could be a problem.

Arvin's solution, while seeding the start number, has the disadvantage, as
Keith has pointed out, of not guaranteeing an unbroken sequence (or a
sequence at all for that matter), for which an autonumber should never be
used, an autonumber being intended to ensure arbitrary unique values and
nothing else (which is presumably why Microsoft changed it from 'counter'
after version 2).

A solution which covers all of these points, and also allows the next number
used to be reseeded at any time can be found at:

http://community.netscape.com/n/pfx/forum.aspx?nav=libraryMessages&tsn=1&tid=23839&webtag=ws-msdevapps


It is a little more complex than the other solutions as it stores the latest
number in a separate database which is transparently opened and updated
exclusively in code to get the next number. Consequently only one user can
get the same number, but without the need to save the current record
immediately, so non-key fields can have their Required property as True in
the table's design.

Ken Sheridan
Stafford, England

Tara Metzger wrote:

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/201001/1

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Dynamic ASP.NET Excel Workbooks In C#
http://www.eggheadcafe.com/tutorials/aspnet/6a2d1dff-5379-4e9f-890d-94301c5edc4d/dynamic-aspnet-excel-wor.aspx