Hi,
Refer to link of image.
http://i267.photobucket.com/albums/ii28 ... marker.jpg
Both are screenshots of my problem; before and after.
The thing is that when I change my Starting Date, I want to point to the first record and reset all my prices.
I placed my coding under
"Starting Date" - OnValidate().
MODIFYALL("Special Price (USD)",0);
MODIFYALL("Special Price (SGD)",0);
MODIFYALL("On Offer",FALSE);
RESET;
The funny thing is that when I change the date, all my prices will reset
EXCEPT for the one that the pointer is at. ](*,) Refer to picture again; the bottom one.
I even tried changing the property
SourceTablePlacement to
First. Didn't help either.
Kindly advice anyone. Thanks. [-o<
Comments
[/code]
Error Message...
CurrForm.UPDATE cannot be called from here.
I read the help guide. It says you cannot call update function at OnValidate trigger.
I tried elsewhere. OnAfterValidate trigger. It works. But another message pops out.
Message...
Do you want to rename the record?
I played around with it. Changed your code.
OnAfterValidate trigger.
Cause your code will cause the item to move to first line and overwrite the first record. I just want the pointer to be at first record.
Kindly advice. Thank you for helping.
"Starting Date" is a table field? If not ignore my comment about the modify-trigger and try to set the values directly in the validate trigger.
Have you tried to call FINDFIRST; in the OnAfterValidateTrigger?
[/EDIT]
The validate-trigger is called before the form modifies the record to the values that are currently stored in rec. Your modifyall statements will modify all records (including the current), but the modify called from the form will override the current record. The simple solution would be to use something like:
BUT: I consider it bad style to change other records from inside the validate trigger. The validate trigger should test and ensure the integrity of the current record.
You can use the modify trigger to update the values (rename-trigger if "Starting Date" is part of the primary key):
Using the modify/rename-trigger you ensure that the values are only changed if modfiy is actually called (may, for example, not be the case if you call validate from inside your code and decide afterwards not to modify the record).
Regards, Simon
http://www.sist.biz/en/ [en] | http://www.sist.biz [de]
RIS Plus, LLC