Hi folks. Been using Access for a couple months now, and trying to get into writing the VBA myself. Very new at this (like 2 hours new), so this is probably absurdly basic, but bear with me.
So basically what I want to do is this: I have two tables, Inventory and Mixtures. Mixtures is a linked table to another database, and there's a one-to-many relationship from Inventory to Mixtures. What I want is for the database, on load, to iterate through each new entry of Mixtures, fetch a particular value from each row, and subtract that value from the corresponding entry in Inventory.
Now, I only want this to be done for NEW entries to Mixtures, so basically I want to store somewhere the highest primary key in Mixtures from the last time the code was run. How do I do this? Will the variable in the code automatically be preserved from session to session? If so, how do I set an initial value for the variable only the first time the code is run?