Have a look at this thread for a solution for idea no. 1 Fetch query from parent page.
BTW. Is there a reason why you need the code instead of just the name of the event?
I will test the second option, haven’t done it myself yet but would really be useful for lots of similar use cases. I also think it should not be saved in /content but in /assets, but that should not be a problem.