Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unique Value Table Not Updating
Message
From
07/07/2000 13:47:44
 
 
To
07/07/2000 13:46:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00389578
Message ID:
00389596
Views:
16
>>I am having a problem getting a serial-number table updated.
>>
>>I have a form MYFORM.scx. In it, I want to fetch the next
>>available key value from a table and increment it.
>>
>>
>
>>MYFORM.scx has the following DataEnvironment:
>>	ULOGKEYS
>>	USERLIST
>>	SOITEM
>>	USERLIST1 (a 2nd copy of USERLIST for dupe checking)
>>	
>
>>ULOGKEYS is a one-field, one-record table. The record holds
>>the next available key. When MYFORM.FetchNextKey() is called,
>>it should lock the record, return the value, increment the
>>field, and unlock the record.
>>
>>
>>
>
>>in MYFORM.Load I have:
>>	set multilocks ON
>>
>>	=CursorSetProp('Buffering',2,'USERLIST')
>>	=CursorSetProp('Buffering',2,'SOITEM')
>>	=CursorSetProp('Buffering',5,'ULOGKEYS')
>>	
>

>>
>
	
>>in MYFORM.FetchNextKey() I have:	
>>	cRetVal = ULOGKEYS.CurrKey
>>	nCurrKey = val(ULOGKEYS.CurrKey)
>>	nNextKey = nCurrKey + 1
>>	cNextKey = allt(str(nNextKey))
>>	replace ULOGKEYS.CurrKey with cNextKey
>>	x = TableUpdate(.t.,.t.,'ULOGKEYS')
>>	UNLOCK IN ULOGKEYS
>

>>
>>
>
>>after the TableUpdate:
>>	cRetval = "2"			&& Correct
>>	nCurrKey = 2.00			&& Correct
>>	nNextKey = 3.00			&& Correct
>>	cNextKey = "3"			&& Correct
>>	x = .T.					&& Correct
>>	
>>	BUT:
>>	ULOGKEYS.CurrKey = "2"   && I want it to be "3"
>

>>What am I missing?
>>
>>Thomas G. Hirschman
>>
>
>Without taking a long look at your code and an in ULOGKEYS on the replace line. If your at EOF in your current area it will not replace successfully.

I'm sorry that wasn't clear. The line should be.
replace ULOGKEYS.CurrKey with cNextKey in ULOGKEYS
Previous
Reply
Map
View

Click here to load this message in the networking platform