One other thing I forgot. I think this applies to MM6.1.2 -- if not take this with a shaker of salt! Oh yeah, and buy MM7!
There is a "new" kBizObj method, GetBizObject() that retrieves secondary object references with a little twist o' mojo that helps avoid dangling references.
It adds a custom property, 'lCreatedNewInstance,' to the new object. Later, if that property is .T., you'll know whether to call Destroy(), or set it to .NULL.
---J
>Hi,
>
>I'm having a problem in an app where one bizobj needs to instantiate a second bizobj for a lookup.
>
>The main bizobj is punch_bo and the lookup bizobj is employee_bo.
>
>punch_bo:postinithook:
>This.oEmployee_bo = createobj("employee_bo")
>return .t.
>
>When employee_bo is instantiated it becomes amnesic and "forgets" all about the current database so I'm prompted to select the table as if none were specified.
>
>The two bizobjs are not in a parent/child relationship.
>
>The database is in a remote drive (G:). This is established in the ini file I'm using and also in the metadbc.dbf table.
>
>I have traced the code in employee_bo.
>
>The problem takes place in the employee_de.opentables() method. Even though all the properties (database, alias, etc.) seem to be in order, once the line:
>This.oDataEnviroment.OpenTables() is executed, BOOM, I'm presented with a dialog box to select a table.
>
>What's going on here?
>
>Thanks for any ideas!!!
>
>Alex