If I understand your description correctly, you need a relationship from Stock to Invoices. If so, then in your StockCode table, define two globally stored calculation fields, result type date, gcTodayThisYear and gcTodayLastYear.
Define gcTodayThisYear as Get ( CurrentDate ). For gcTodayLastYear, use Date ( Month ( Get ( CurrentDate ) ) - 12 ; Day ( Get ( CurrentDate ) ) ; Year ( Get ( CurrentDate ) ) ), (Note that on the 29th February, this yields the 1st March of the previous year).
Base the relationship from Stock to Invoices on:
Stock::gcTodayThisYear >= Invoices::invoiceDate
Stock::gcTodayLastYear <= Invoices::invoiceDate
Stock::stockCode = Invoices::stockCode
Thanks a lot
I just had brain ache and couldn't think.