PDA

Click to See Complete Forum and Search --> : auto numbered fields - OHHI they hurt


kovan
Aug 22nd, 2000, 07:17 AM
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

JHausmann
Aug 22nd, 2000, 12:07 PM
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.

AKA
Aug 23rd, 2000, 02:47 AM
http://forums.vb-world.net/showthread.php?threadid=26891