>>>Vfp50 - Auto Numbering Problem
>>>
>>>This is my code:
>>>
>>>use myview
>>>= cursorsetprop("buffering",3)
>>>append blank
>>>
>>>inoldarea = select()
>>>set reprocess to automatic
>>>if !used("new_num")
>>> use new_num in 0
>>>endif
>>>select new_num
>>>if rlock()
>>> repl auto_num with auto_num + 1
>>> unlock
>>>endif
>>>select(inoldarea)
>>>
>>>Now - when I go to save the information back to the TABLE from the VIEW, I am getting an ERROR MESSAGE saying…PROPERTY IS INVALID FOR TABLE CURSORS..
>>>It seems like my VIEW is not the current ControlSource. Can someone help?
>>
>>why not make the auto_num part of the code a stored procedure and call it from the table field definition?
>
>Thanks Dave for you answer… I was wondering when a super visual foxpro wizard like you was going to answer one of my question. I have never written a stored procedure. Could you give some starter advice (code maybe)..thanks rob
your code was fine (it would work anyhow).
i use this:
procedure fill_activity
if !used('uniqueid')
use po_cgms!uniqueid in 0
endif
select uniqueid
local llLock
local lnRetVal
llLock = .f.
do while !llLock
if rlock()
llLock = .t.
llRetVal = uniqueid.idnumber
replace idnumber with idnumber + 1
unlock
endif
enddo
return llRetVal
this goes in the stored procedure portion of your dbc.