General information
Category:
Coding, syntax & commands
Title:
Replacements into Related tables
got a problem with replacements into a related table happening when they shouldn't.
all my major tables have a field called 'locked' which can be set at various points in the application to prevent further amendments to the record.
I also allow users to write changes into related files in various circumstances. Safeguards include protected fields and protected records
i.e. the 'locked' records (and some others which are not relevant here) can't be amended by such replacements.
or at least thats how things should be.
In fact, if I set up test conditions, with, say, a couple of dozen records linked to locked records in a related file and then do the replacement, instead of blocking them all, it allows just one record - always the first - to be amended.
The code was originally
REPLACE ALL (FIELDNAME) WITH (FIELDGET) FOR &REPCOND
thought perhaps the redundant 'ALL' was causing the problem so shortened it to
REPLACE (FIELDNAME) WITH (FIELDGET) FOR &REPCOND
no improvement.
so replaced it with a scan loop
LOCATE
SCAN
IF &REPCOND
REPLACE (FIELDNAME) WITH (FIELDGET)
ENDIF
ENDSCAN
still no change.
At which point I ran out of ideas!
I might add that this seems to work fine in the DOS version. Only VFP gives me the problem.
Harry
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only