Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't update the &%!#@ field
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00051833
Message ID:
00052185
Views:
49
>>>>I just changed the code to select before the replace. No help. I know that in other places in my app I replace in other work areas all the time, so I experimented in the command window just to be sure:
>>>>
>>>>USE table1 in 0
>>>>USE table2 in 0
>>>>sele table 1
>>>>replace table2.field1 with "ZZZZZ"
>>>>
>>>>This works fine. The table gets updated no problem.
>>>
>>>The tricky thing about replacing into another work area is that most of the time it will work. When it fails it generates no error message. The problem occurs if table1 is at EOF. The replace will fail in this case. The safe way to do a replace is select the table first. In VFP you also have another option, add the IN TableAlias clause to the replace (REPLACE Field1 WITH "ZZZZ" IN Table2).
>>
>>I just tried the scenario and it fails sure enough! That is WIERD!!!
>>I went back to my problem procedure and added the select again. (-Edward- I had added it in the wrong place before):
>>
>>locate for join_cancel.jmembnum = currentmember;
>>and join_cancel.activity = "JOIN";
>>and join_cancel.jdate > currentjdate;
>>and deleted() = .F.
>>
>>sele memb
>>
>>if !found() then
>> replace memb.orig with currentjdate
>>endif
>>
>>Where it needed to be inside the 2nd if statement (Found() gets reset when switching Work areas)
>>
>>Thanks for your help, guys, I would have NEVER figured that out.
>
>
>Eric
> It may help if you would quit calling your fields &%!#@.
> Just a thought !!!
> Hope things are going well and it looks like the guys have you covered.
>
> Jeff Butler

I have decided to use only punctuation marks in my field names in an effort to positively avoid accidentally using VFP reserved words. If I discover that there is a VFP reserved word that matches one of my sequences of punctuation marks, I simply change that field name to the actual expletive that the sequence represents. ('$@!' --> 'piece_of_s**t') I also use this naming convention with UDFs and procedures, and plan to incorporate it in my framework (soon to be available for resale). :-)
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform