Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNLOCK Changes Data

Status
Not open for further replies.

tekytippy

Programmer
Jan 5, 2004
19
NL
I use an unbuffered table and make some changes to it. When the user leaves the screen I unlock the record using UNLOCK IN order_header.

If I watch the debugger at this point a certain field contains 'K' but as soon at the UNLOCK IN order_header line runs it changes back to its previous value.

I then changed the code to this

SELECT order_header
REPLACE order_header.h_order_status WITH 'K'
UNLOCK IN order_header

On the UNLOCK it still sets the order_header.h_order_status back to 'P' its previous value.

I am using an unbuffered table without transactions.

Any ideas why this should be happening?
 
However....

If I add a copy of the replace code and unlock after the first replace and unlock, the second set works. i.e.

SELECT order_header
REPLACE order_header.h_order_status WITH 'K'
UNLOCK IN order_header && Gets Set Back To 'P'

SELECT order_header
REPLACE order_header.h_order_status WITH 'K'
UNLOCK IN order_header && Remains At 'K'


Obviously I can't use this but it must mean something?
 
Dave,

I've tried to reproduce the behaviour you described, but cannot. What version of VFP are you using?

I ran your code from the command window, checking the field value in the debugger. Everything looked fine.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Besides the version and service pack level of VFP, just where are the data files? On the local machine? On a peer-to-peer share? On a File server? What OSs are the workstation and the "file server"?

Rick
 
Mike
VFP7 SP1

My code works ok in the command window too. I must be doing somthing in my app to get this behaviour somehow?

Rgbean
All Files are on local computer.
 
In the situation where you see the data revert to its old value, do you still have focus on the field when you issue the UNLOCK statement? A field doesn't fire the valid or actually save the data to the controlsource until you move the focus off of it.


-BP (Barbara Peisch)
 
also, make sure you are on the correct record in the data file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top