Arthur Fuller
artful at rogers.com
Wed Jul 9 13:22:23 CDT 2003
Welcome back, Ginny! You have to make a decision about who assigns the numbers: users or the system. It reads as if you want the latter, but the problem may be that the existing numbers may not conform to the rules. The solution is: who cares? Accept all existing entries as valid and proceed from there. IMO you are best off normalizing these virtual columns into actual columns. Why? Ease of coding. For example, given inputs such as: DC-2101-0001 DC-2204-0001 DC-2301-0001 LA-2605-0001 LA-2605-0002 LA-2605-0003 NR-2605-0001 IMO these three parts belong in separate columns. It looks like the first column is a table of a very few entries. The second column is... who knows? Input? Derived? Doesn't much matter, but if derived it can be a lookup. Column 3 is also derived, something like =Format(DMax("myPK", "myTable", "myParentPK = " & nnnn), myLeadingZeroesFormat ). Write a function that returns the next ChildID something like this: Function NextChildID( strPK as String, strTable as String, strParentKey as String, lngParentKey as Long ) As Long Dim lngLastID as Long lngLastID = DMax( strPK, strTable, strParentKey & "=" & lngParentKey ) NextChildID = lngLastID + 1 End Function Invoke it in the BeforeInsert event of the form. Arthur -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030709/dc622ded/attachment-0001.html>