I'm trying to update field values across all companies. Never to be accused of making something too simple, perhaps that's what I'm doing. I run this algorithm and only the record in the company that I'm on is changed. I've put a call to my function in each field that I want to run the update.
Oh. And I think this really should be simple because all of the fields that I'm updating are boolean.
What am I doing wrong? Help?
SetupChange(FieldNo : Integer;Value : Boolean)
IF locCompany.FINDSET THEN REPEAT
thisRec.CHANGECOMPANY(locCompany.Name);
IF locCompany.Name <> COMPANYNAME THEN BEGIN
thisRec.GET();
CLEAR(RecordRef);
RecordRef.OPEN(50007,FALSE,locCompany.Name);
FieldRef := RecordRef.FIELD(FieldNo);
FieldRef.VALUE(Value);
RecordRef.MODIFY;
END;
UNTIL locCompany.NEXT = 0;
0
Comments
Hi
you must do
RecordRef.GET;
//processing
or
IF RecordRef.FINDSET THEN
REPEAT
//processing
UNTIL RecordRef.NEXT = 0;
Bye
Matteo
BTW, did you try to use gettable function instead -see online help-? (i'm just guessing)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
IF locCompany.FINDSET THEN REPEAT
thisRec.CHANGECOMPANY(locCompany.Name);
IF locCompany.Name <> COMPANYNAME THEN BEGIN
thisRec.GET();
CLEAR(RecordRef);
RecordRef.OPEN(50007,FALSE,locCompany.Name);
RecordRef.FINDFIRST;
FieldRef := RecordRef.FIELD(FieldNo);
FieldRef.VALUE(Value);
RecordRef.MODIFY;
END;
UNTIL locCompany.NEXT = 0;