Hi,
I m using NAV 4.0, want to update the STATUS field on my master table while Print the REPORT .
The below code is running fine and show the status message correctly but it's will not update the table...
Status field is dropdown: 0 for pending,1 for working, 2 for completed
Code:
Sales Header - OnAfterGetRecord()
IF CurrReport.PREVIEW = FALSE THEN
BEGIN
recCorrEnq.RESET;
recCorrEnq.SETRANGE("Document No","Sales Header"."Correspondence Reference No");
IF recCorrEnq.FIND('-') THEN
BEGIN
MESSAGE('Before-->Doc No:' + recCorrEnq."Document No"+ ' status:' + FORMAT(recCorrEnq.Status));
recCorrEnq.Status:=2;
recCorrEnq.MODIFY;
MESSAGE('After-->Doc No:' + recCorrEnq."Document No"+ ' status:' + FORMAT(recCorrEnq.Status));
END;
END
Note: output message is fine, NOT UPDATE THE DB TABLE.
0
Comments
You filter only on the Document No. Exist there are more then one recCorrEnq with this No.?
Is the PK really only the Document No in recCorrEnq table or also the document Type?
Thanks for quick reply..
1. 'recCorrEnq' a other table(which is having STATUS filed)
2. 'Document No.' is not repeated
3. 'Document No.' is only Pk filed
Thanks & Regards,
Psk
2) Use the client monitor to look for mre details. Check that the record in your table is modified only once and on the correct point. If there are other modify actions, look where and check the logic.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I hv done, silly mistake while printing i clicked 'YES' then there is no printer here so finally system asking the print save file name THERE IS A MISTAKE i select CANCEL. Now i clicked to SAVE the print file now it's UPDATED.
Note: mistake was final printing i clicked cancel button b'cz no printer. I use SAVE the print file.