Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004

    Unanswered: auto generate next number

    Hi All,

    I have a primary key which is a text field. I used the following dmax function to get the next number:

    Me!VdrID = DMax("[vdrid]", "[tblsuppliers]", 1) + 1

    However, after the 10th number, it stopped. It keep on giving me the same number 10th instead of number 11th.

    How can I solve this?

    P.S. The field needs to be a text field because I am combing this field with another text field to create a unique id.

    Thank you all for your help.


  2. #2
    Join Date
    Feb 2004
    Text is sorted 1,10,2..9 where numeric values are sorted 1,2..9,10.

    That is why the outcome of the function will always be 10 (after u have 10 numbers assigned)

    Why does the field have to be text? U can also combine a numeric value with a text value so what is the problem?

  3. #3
    Join Date
    Sep 2003
    Simple solve:

    Me!VdrID = DMax("CLng([vdrid])", "[tblsuppliers]", 1) + 1

    ... And I went with a long to allow for ID's past 32767 ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Jul 2004
    Thank you irenicuz and M.Owen for your help.

    My problem is solved.

    I didn't know I can combine a text value with a numerical value.

Posting Permissions

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