Re: Best Place to put CDNewID() if not put in the table or v

Author: Ed Leafe

Posted: 2004-01-08 at 07:18:56

Quote: >>Where is the best place to put in the command

replace iid with CBNewID("tablename")

I have considered bo.beforenew()

Any place that is more righter than this. Please note I will be using

this in the parent_bo as well as the child_bo same place. Hope this

does not disturb the auto populating of the child FK.

This is already done for you in the OnNew() method, if you have that

set as the default value for the iID field. BeforeNew() wouldn't work,

since the new record isn't created yet - you would be changing the ID

of the current record there. AfterNew() could also work, but that is

fired after SetMemento(), so that changing the ID there would mark the

record as modified, requiring the "Do you want to save your changes?"

message box if the user immediately cancels the Add.

©2004 Ed Leafe