Results 1 to 3 of 3

Thread: auto numbered fields - OHHI they hurt

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Angry

    here is the problem i ran into

    i got 2 tables
    both linked throu TagID
    its a one to many relationship

    on the ONE relationship
    i have the TagID autonumbered
    how ever i cannot have auto numbered in the MANY table
    due to that there could be more than one in that table

    the solution i have came up with

    when saving a record
    after the part to ONE is saved
    retrieve the highest numbered in ONE table and use it as TagID in the many table
    sometimes this craps out
    because if the first part doesnt save properly then the tagNum in the MANY doesnt refer to the right record in ONE table

    anyone have a solution
    would be greatly appreciated
    thank you kindly

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Create another table that has one entry, a long integer called LatestTagID. Whenever you write to the autonumber table, bookmark the record, retrieve the record you just wrote and update LatestTagID with the value you just retrieved. If you allow deletes, you cannot use max() on your table that contains the autonumber and get a reliable answer.

  3. #3
    Lively Member
    Join Date
    Jul 2000
    Location
    Stockholm, Sweden
    Posts
    83
    Yesterday, all my troubles seemed so far away...
    Help, I need somebody, Help...
    Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.

Posting Permissions

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



Click Here to Expand Forum to Full Width