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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REPLACE command in VFP7

Status
Not open for further replies.

cj001

Programmer
Oct 3, 2001
145
US
Hello,

Would someone please inform me what's wrong with my code?

I have 2 tables.

I have 3 fields in table TEST.
I have 4 fields is table EQUIP.

I match between 2 to tables using TEST.A01 and EQUIP.EQID
I'm replacing 2 fields in the EQUIP table from 2 fields in EQUIP table.

The code below seems to work. When it runs the browse command it shows that the data has been successfully replaced in all the matching records.

BUT when I close the program and open the table in FoxPro to look the replaced data isn't there.

I checked to make sure that the tables TEST and EQUIP do not exist anywhere else on my computer and they do not.

Thanks!
CJ



SELECT test
SET NEAR ON
SCAN
seqid = test.a01
sdpnm = test.a02
spphr = test.a03

SELECT equip
SCAN for equip.eqid = seqid
** ************************************
replace equip.dpdesc WITH sdpnm IN equip
replace equip.pphr WITH spphr IN equip

ENDSCAN
ENDSCAN
SELECT equip
GO TOP
BROWSE
 
Hi CJ.

>> The code below seems to work. When it runs the browse command it shows that the data has been successfully replaced in all the matching records.

BUT when I close the program and open the table in FoxPro to look the replaced data isn't there. <<

It sound like your data is table buffered. If this is the case, you need to use code like this:

IF TABLEUPDATE( 1, .F., 'equip' )
ELSE
*** use AERROR() to figure out what went wrong
ENDIF

Alternatively, you can turn off table buffering using the CURSORSETPROP() function.





Marcia G. Akins
 
Thank you MarciaAkins!

You are absolutely correct.

I forgot to add TABLEUPDATE command to my program and now it works as it should.

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top