• DMax function (Access 2000)

    Author
    Topic
    #358411

    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

    Viewing 0 reply threads
    Author
    Replies
    • #534733

      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

    Viewing 0 reply threads
    Reply To: DMax function (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: