Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005

    Unanswered: semi-autonumber compound primary key

    Howdy! So I've got a compound primary key consisting of two fields for my table, neither of which are unique, but together are. I'd like to set the first key in my input form (no problem), and then with "acNewRecord" automatically increment the other key. When I reach the end of the first key (in example: A0001, 3) the form will be closed (also no problem, as the Key2 refers to another form). When the form is reloaded for a new "key1 entry", I would again set he first key and the second would again start at 1. In some ways I want the second key to be an <autonumber>, but I need to be able to reset it. Suggestions?

    Key 1 Key 2
    A0001 1
    A0001 2
    A0001 3
    A0002 1
    A0002 2

  2. #2
    Join Date
    Sep 2003
    Generally speaking I'd use a dmax/dlookup function to get the highest # and then increment to the next ... (actually I do do that ...)
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jan 2005
    hey thanks! I guess I need to learn a bit more, of course. Thanks again.

Posting Permissions

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