I know I've done these before, but the only one I can think of off the top of my head is still in 3.x format and uses a UDF for a date. A couple of things, though - I don't think you need the PO History files because the Required Date is in the PO Receipt files, so that should be all you have to compare the actual receipt date to. And the Vendor name is included in the Receipt files, too, I think, so you wouldn't need the AP_Vendor unless you need more than name. Fewer files, quicker running.
I'll keep trying to think of who else I may have written this for and will send one over if I can find it.
------------------------------
Beth Bowers
Mom to Samson, Peanut, ChiChi, Canton, Cagney and Daisy (NO Oxford comma - shriek!)
Tennessee Software Solutions
269-445-1625
------------------------------