Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    DMax function (Access 2000)

    Dmax function

    I use a function called Dmax to increase the number of my invoices with 1.
    I want the function to look for the highes invoice number(invoiceid) in the database, and to increase This numnber with 1.I have tried to build the following function without success:
    increment = DMax("[invoiceid]", "[orders]", "[invoiceid]") + 1
    In this case I receive impossble figures. For example the number of the last
    Invoice is 6700 and I receive 227300.
    The function Dmax however works with me in the following way:
    increment = DMax("[invoiceid]", "orders", "[invoiceid]< 9000 ") + 1
    'I have this function and it works, however I do not want to
    be restricted by the number 9000
    How can I avoid the restriction of 900 and apply this function more flexible?
    To be more exact, how can I make the folowing function work?
    increment = DMax("[invoiceid]", "[orders]", "[invoiceid]") + 1

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: DMax function (Access 2000)

    The syntax for Dmax is DMax("[fieldname]","tablename","[criteriafield]=criteriavalue"). You've got a field name in the critiera portion without any value for it, which is probably what's giving you weird results. Try this:

    increment = DMax("[invoiceid]", "[orders]") + 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts