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

What's up with REPLACE?

Status
Not open for further replies.

Kerbouchard

IS-IT--Management
Aug 28, 2002
145
US
This is supposed to work like this-
User selects the line in the grid they want to edit and click the EDIT button. This sets the controlsource of the textboxes above the grid to the controlsource of the grid. Here the user can make their changes and click the SAVE button. Then the commands below should occur. This is the third CASE statement of DO CASE but it's the only one that doesn't work. Nothing gets updated with the user changes.

CASE thisform.txtitem.controlsource="quotes1.item"
replace extprice with thisform.txtprice.value*VAL(thisform.txtquantity.value) IN quotes1
replace discount with thisform.txtdiscount.value IN quotes1
replace disc with VAL(thisform.txtdiscount.value) in quotes
replace discext with (thisform.txtprice.value*VAL(thisform.txtquantity.value))-(thisform.txtprice.value*VAL(thisform.txtquantity.value)*(VAL(thisform.txtdiscount.value)/100)) in quotes1
replace image with a_icitem.picture2 in quotes1
tableupdate()
thisform.txtitem.controlsource=""
thisform.txtquantity.controlsource=""
thisform.txtitemdesc.controlsource=""
thisform.txtprice.controlsource=""
thisform.txtdiscount.controlsource=""
thisform.grid1.doscroll(2)
thisform.grid1.refresh()
thisform.refresh()
thisform.image1.picture="S:\images\noimage.bmp"
thisform.txtitem.setfocus()

Any help would be greatly appreciated, I've been looking at this stupid thing all morning.

 
Ensure the table you are updating is the current work area and that it is not on EOF()

Sometimes, in instances like this, the replace does not provide an error - it just doesn't work.

Jim Osieczonek
Delta Business Group, LLC
 
Thanks for your help Jim. I suspended the program and opened the table, it did look like it was on the correct record and not at the end of the file.

Is there a work-around you could suggest?

Thanks in advance!
 
Well, if you're certain that the case statment evaluates to true and the code is being run, I'd suggest:

with thisform

replace <alias>.extprice with .txtprice.value*VAL(.txtquantity.value), ;
<alias>.discount with .txtdiscount.value, ;
<alias>.disc with VAL(thisform.txtdiscount.value)
in "quotes1"

unlock in "quotes1"

endwith

specifying the alias points to the file and the with verb optimizes for speed.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top