Re: Is there a better way > Auto Enter Serial Number in FMPro 9?



In article <1191178836.479672.283070@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Grip <grip@xxxxxxxxxxxxx> wrote:

On Sep 29, 11:45 pm, d-42 <db.pors...@xxxxxxxxx> wrote:
On Sep 29, 11:26 am, EJay Corvette <Eric.J.Merch...@xxxxxxxxx> wrote:



I've been searching for a couple days now for the solution to
resetting the "Record Number" in my database. The Record Number is a
Serial Number and should increment by 1.

The problem I'm having is whenever a record is deleted (usually the
last record entered), my numbering is off, and I have to manually
reset the Serial Number before someone inadvertantly starts a new
record.

For example, if my records are 09, 10, 11, 12, and record 12 is
deleted, the Serial Number will then install 13 as the next available
record number.

I was able to locate this simple looking enough script from the web:

Enter Browse Mode []
Allow User Abort [Off]
Show All Records
Unsort Records
Go to Record/Request/Page [Last]
Set Next Serial Value [Client Records::Record No + 1]

The problem is, I can't get it to work. Anybody out there have a
solution?

Well, the allow user abort is superfluous. The rest of the script
looks fine; except that it appears that you haven't specified which
field to set next serial value. You've told it what to set it *to*,
but not what to set.

The bigger question is -why- are you doing this? The need to reset
serial numbers, except after an import, is usually a design error.
There are cases where its justified. But for the most part, we only
require that serial numbers be unique, not sequential with no gaps in
the numbers.

An exception, for example, might be invoice numbers, where you don't
want gaps, but in that case its usually better not to be able to
delete records at all, period. If a record is created that you don't
want, mark it as void. Or alternatively, don't assign it an invoice
number until you are sure you want to keep it. (Assign it an order
number or reference number until your sure its a keeper.)

-cheers,
Dave

What are the circumstances in which you use Allow User Abort?

G

Often considered good practice in a database designed for use by
database customers. Helps to prevent the customer from interrupting a
script and thus ending up in some place not familiar to the him/her and
from which he/she does not know how to get back where he/she started.

--
For email, change <fake> to <earthlink>
Bill Collins
.



Relevant Pages

  • Re: Split database continued
    ... The code for creating a one off invoice takes 12 seconds with the database ... Private Sub Create_New_Invoice_Click ... Dim Invs As DAO.Recordset ...
    (microsoft.public.access.formscoding)
  • Re: Problem with a template from the MS Office website
    ... noted and have resolve them and reposted them the updated db to our web. ... database. ... I suspect it will be ages before my Access and VBA ... and controls so that the Invoice Report ...
    (microsoft.public.access.reports)
  • Re: A Challenge?
    ... It then creates a new new invoice, ... > that would get updated in the main database and also added to ... An item can be on an uncomplete trade counter invoice when a counter ... >> exponentialy slower as the database grows. ...
    (comp.sys.acorn.apps)
  • Re: Large Lists - Please read and comment
    ... When I explain better techniques used with C/S, ... > upsizing the database. ... I have invoice and payment transactions for over 200 different ... >>> incorrect in a number of ways such as wrong company, wrong customer, ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Large Lists - Please read and comment
    ... > If it weren't for the 2 million record limit I wouldn't even consider ... > upsizing the database. ... >> Microsoft Visual FoxPro MVP ... I have invoice and payment transactions for over 200 different ...
    (microsoft.public.fox.programmer.exchange)