Hi Nadya
I just hit this old problem of yours for myself.
The solution I would like to see is a change to my nextkey() SP so that it ensures the keytable being used lives in the same DBC as the table requiring a new key.
something like.
lcDBC = cursorgetprop('database')
If USED("NextKey") and dbc('database','nextkey')<>lcDBC
use in NextKey
endif
If USED("NextKey")
select nextkey
else
Use (lcDBC+'!'+'nextkey')
Endif
I was wondering if you had come across something like this in your searches
regarding your problem and had a debuuged example I could use.
>Hi everyone,
>
> We were just hit by this problem: we have lNextID function in our common procedure file. We also have a function with the same name in different DBC stored procedure. I noticed, that the wrong function was called, even if I set database to myDatabase. I have a view, which is based on tables from two databases (Stats - my database and Customer table, which is part of JobControl database). I put code in form's Add method:
>lnRegionID=lNextID('Regions') and it invokes lNextID from JobControl database stored procedure, not my Stats database.
>
>So, how should I ensure, that my code is called. Right now I decided to change name of my stored procedure function to GetNext_ID, but it's not a universal solution.
>
>Another problem:
>My underlaying table has a default value, which is (changed it right now) GetNext_ID('Regions')
>
>In my add method I do:
>lnRegionID=GetNext_ID('Regions')
>insert into RegionsInfo (RegionID,...) values (m.lnRegionID,...), where RegionsInfo is a view based on Regions table (only this table).
>
>The question is: when I save the record, would it try to excecute this GetNext_ID twice, since my table has default value? Right now it seems to be doing that. What should I do to do it only once?
>
>Thanks in advance.