Refresh on Form control

Hi, I have a question regarding refresh(F2). On Sales Order Form(Sales Header) on Posting Date field the Date is inserted from the FORM “On After Get Record” trigger “Posting Date” := WORKDATE; Once the Posting Date is inserted i have to press F2 to validate the Document Date, How to Validate the Document Date field on sales header automatically instead of pressing F2 on posting date to refresh. Thanks Brat

quote:


“On After Get Record” trigger “Posting Date” := WORKDATE;


Replace with

Validate("Posting Date",WORKDATE) 

------- With best regards from Switzerland Marcus Fabian

quote:


Originally posted by fabian:

quote:


“On After Get Record” trigger “Posting Date” := WORKDATE;


----- Hi Marcus, I have replaced the code on FORM Trigger “On After Get Record” with VALIDATE(“Posting Date”,WORKDATE); Now when i try to open the FORM i am getting a message “You Cannot make any changes on the Database from this Trigger” Any suggestions Thanks Brat Replace with

Validate("Posting Date",WORKDATE) 

------- With best regards from Switzerland Marcus Fabian


I did some checking and the error is on a line where the Sales Line table is trying to be locked. This happened in the VAT Base Discount % field OnValidate Trigger. The OnAfterGetRecord trigger can NOT make modifications to the database, as the error message says. Why do you want to populate the Posting & Document dates “AFTER” you get the record? If you purpose is to populate a Order with those dates at entry time, you can move your code to the OnInsert trigger. Also, if this code actually worked it would change the date of any order that happened to be viewed. Is that what you want? If so, feel free to e-mail me and we can discuss your options. Hope this helped. Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

Why do you want to Validate the “Document Date”? When you insert the “Sell-to Customer No.” the “Document Date” is Validated to Caculate the “Due Date” based on the Customers “Payment Terms Code”! If you wanted to change the “Document Date” after this you would just tab to the field and enter a new value! Why not leave the fields alone until you Post the order? Then Confirm and Validate the “Posting Date” and “Document Date” before posting a simple button on the form would do and a Confirm Check in the CodeUnit 80 if the Posting Date did not match the WORKDATE and NOT ReplacePostingDate for batch posting. WARNING: (1.30) If you part Ship and Validate the “Document Date” between shipments and you have a “Line Discount” strange things happen and the Discount is doubled on each shipment! David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk Edited by - David Cox on 2001 Jun 15 21:47:04