Create a local view in the dbc and requery that view when you need a new ID. Believe it or not, the following works for me:
create sql view v_NextID as select lNextID(?cAlias) NextID from Kounters where Table_Name = ?cAlias
Kounters is the name of my ID table.
>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.
Mark McCasland
Midlothian, TX USA