Re: Help:creating a new invoice?




"Bernard Peek" <bap@xxxxxxxxxx> wrote in message
news:YWHnuYWOpiaDFwk9@xxxxxxxxxxxxx
> In message <1131030203.356943.202700@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
> "NomoreSpam4Me@xxxxxxxxxxx" <ugo_lavoie@xxxxxxxxxxx> writes
> >and on my form i have a Save button and a Back tu main menu button.
> >
> >
> >even if i dont save it the autonumber goes up by 1 each time.
>
> One way to handle this is to search the invoice table for the largest
> invoice number, add one to it and then use this as the next invoice
> number. If it is a large table this could be slow.
>
> Another approach is to use a table that has one row and one field. When
> you create an invoice you:
>
> 1. read the number stored there
> 2. add one to it
> 3. store the new number, overwriting the old one
> 4. create the invoice record using the new number
>
> The order that you do things can be important. If the process is
> interrupted or fails part way it is better to have a gap in the sequence
> than to have two invoices with the same number.
>
>
>
>
> --
> Bernard Peek
> London, UK. DBA, Manager, Trainer & Author.
>

Dmax would search a large table quickly if Invoice number is indexed.
Invoice number could not be duplicated if Invoice number is the primary key.
You would need to check that the append query succeeded before opening to
the new invoice. A 2nd user may grab the next number just before the 1st,
causing a key violation in the append query.


.



Relevant Pages

  • Re: Using two columns as a primary key
    ... To create a 2-field primary key, open your table in design view. ... choose the first field of the index. ... When Access opens the ... invoices are from four companies with their own invoice numbers. ...
    (comp.databases.ms-access)
  • Re: Linked table query
    ... Thank you Duane for answering me so promptly and so late. ... the primary Key fields, and all relationships were set up on the back end. ... query based on multiple linked tables with SQL 2K as the back end. ... info about an invoice such as dollar amount, dates, and so forth. ...
    (microsoft.public.access.queries)
  • Re: 2nd try: have default items on every report
    ... view the product (plant) description in the combo box ... As for printing the complete product listing on every invoice, ... to make it as simple as possible for the customer. ... TrackingNumber <primary Key> ...
    (microsoft.public.access.forms)
  • Re: 2nd try: have default items on every report
    ... sort of invoice system, and that TrackingNumber is the invoice ID. ... LineNumber <Primary Key> ... numbers printed on the report as well and have them recorded in Table2. ...
    (microsoft.public.access.forms)
  • RE: Invoice Form Question
    ... OrdDetails table (odetID as Primary key, ordID as foreign key, products ... Invoice table ...
    (microsoft.public.access.forms)