Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
REPLACE problem - weird (I think)
Message
 
 
À
02/07/1998 00:43:13
Bruce Gilmour
Cal-Mour Consultants
Calgary, Alberta, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00113674
Message ID:
00113780
Vues:
19
Hi,
As others have noted you will be at EOF() if the seek fails, and you cannot write to the phantom record (term for empty record that appears to be at end of table). The other bit of info that you are missing is in the help file

Note If the IN clause is omitted, no replacement occurs if the record pointer is at the end of the file in the current work area and you specify a field in another work area.

So you need to ensure that the table you are trying to replace in is not at EOF, and you should use the IN clause to allow replacements to occur in a different table than that which is selected without having to worry that the current table may be at EOF. This is a well known FoxPro bug, the IN clause is the new work around.
HTH,
Ned

>OK - Another full day of programming and chasing my tail over what seems to be a simple piece of code - but - here it is
>
> WITH thisform.bgpageframe1.page2.grdordlines
> SELECT Item_Master
> SET ORDER TO TAG itemnumber
> SEEK this.value
> IF FOUND()
> REPLACE ordentlines.description WITH Item_Master.description
> REPLACE ordentlines.nonstock WITH .T.
> REPLACE ordentlines.saleunit WITH Item_Master.saleunit
> REPLACE ordentlines.salemult WITH Item_Master.salemult
> REPLACE
> ELSE
> REPLACE ordentlines.nonstock WITH .T.
> REPLACE ordentlines.saleunit WITH "EA"
> REPLACE ordentlines.salemult WITH 1.000
> REPLACE
> ENDIF
>
>And the but is that the REPLACES before the ELSE work but those after the ELSE don't. It is entering the correct section based on whether I enter a stocked item or not. The nonstock setting is in both places as a control and again it works in the first instance but not in the second. What is my smoking brain missing? Help please.
Ned

Reality is.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform