Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace Command syntax
Message
 
 
To
30/10/2000 14:25:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00436016
Message ID:
00436095
Views:
19
>Hi,
>
>I have the following few lines code:
>
>**********************************************************
>sele YearSls
>lcfind = lnYear + lnMonth
>if seek(lcFind)
> repl temp.Cur12Mo with temp.cur12Mo + sls.mosls && this works just fine
>else
> if lcKey = "S"
> sele temp && never had to do this before
> repl temp.Cur12Mo with 0 && doesn't work without line above
> endif
>endif
>**********************************************************
>

Rick,

You should use IN clause in your replace, IOW,
replace something with anothersomething in MyTable

Also, this line confuses me:
lcfind = lnYear + lnMonth

Is lnYear numeric of character? In this context it should be character, but the 'n' letter in variable name is misleading... Same applies to lnMonth.

Last note, I would use lcSearchExpression variable name instead of lcFind. lcFind assumes, what this variable will be always found. Or I became pedantic here? :)



>Notice the line the 7th line down that reads repl temp.cur12mo with 0. The problem is that if I don't first preface that line with the line above it "sele temp" the replace will not work. In other words the field will not be zero but rather whatever it was before. It's as if the command is being ignored. I have never had this problem before. In fact the first replace command in the above code (line 3) works great.
>
>I realize I'm in another work area (YearSls) but I've always done this in the past where I simply reference the alias of the workarea I want to do the replacing in, if it's not the current work area and it's worked fine, or so I thought anyway. . . I just looked at the syntax of replace and I noticed the IN clause. I've never used that in the past.
>
>Is this a vfp bug or something?? really confused here... -Rick
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform