I am trying to create a code unit to go through and delete sales quotes older than 30 days from todays date. I am having an issue with the setrange though. Checking to see if anyone knows what I am doing wrong.
TodaysDate := TODAY;
SalesHeader.SETRANGE(SalesHeader."Document Type", SalesHeader."Document Type"::Quote);
SalesHeader.SETRANGE("Order Date", TodaysDate); //it wont set range, I assume because I have no sales quotes with this date
IF SalesHeader.FINDSET THEN BEGIN
Duration := TodaysDate - SalesHeader."Document Date";
IF Duration > 30 THEN BEGIN
REPEAT
MESSAGE(SalesHeader."No."); //i will put in code to delete here after i get this to work
UNTIL SalesHeader.NEXT = 0;
END;
END;
*This post is locked for comments