Hi all,
I want to create a variable that shows the previous record value in a form.
I mean, something like this:
Field_1 myVar
111 Blank
112 111
113 112
I wonder if this is possible. I'm trying the NEXT(-1) function but no results until now.
Please note that I need myVar to be shown in a form because getting the trick in a report is easier.
Answers
And place:
prevRec := Rec;
EXIT(NEXT(Steps));
in the OnNextRecord trigger.
prevRec will hold the values of the previous record.
You should also place prevRec in the OnFindRecord trigger.
I had already created a prevRec variable but I don't know how to use it in this context. :-(
Anyway, if I place any kind of code in OnFindRecord or OnNextRecord triggers, my whole form stops working!
"I don't want to believe. I want to know." (Carl Sagan)
prevRec := Rec;
prevRec.NEXT(-1);
This will get the literal previous record, the other example gives the previous displayed record.
But I still can't get the record I want because when I place your code in the OnNextRecord trigger, my form only shows one record and no more. And if I place your code in the OnFindRecord trigger, the form shows no record at all.
Until now, I was placing my code in the OnFormat trigger of the previous column but I just got the literal previous record.
"I don't want to believe. I want to know." (Carl Sagan)
prevRec := Rec;
EXIT(FIND(Which));
In OnNextRecord:
prevRec := Rec;
EXIT(NEXT(Steps));
Is this a list/table form or a card type form?
My present code is:
In OnNextRecord:
In OnFindRecord:
About your code:
I am missing something in the OnFindRecord trigger, but what should I write in the place of 'Which' ?
"I don't want to believe. I want to know." (Carl Sagan)
Do the following in OnAfterGetRecord() section
where MyREc is Variable of Type Record
Column in your list with SourceExp MyRec."No."
Hope this helps
Your code works fine -- but if I apply a filter, everything goes wrong. Alas, my form is entirely pointless if I am unable to filter it. :-(
"I don't want to believe. I want to know." (Carl Sagan)
Before the MyRec.Get("no.") put
Myrec.COPYFILTERS(Rec); :P
Albert
But don't go too far -- maybe I need your wisdom once more ;-)
"I don't want to believe. I want to know." (Carl Sagan)