Unanswered: Help with getting Data Macro's to work...
I could really use some help with setting up Data Macro’s in my Access 2013 database. I’m new to using them (and have no VBA knowledge) so could use help.
This database’s goal is farming related. They want to track Hay bales that are harvested (hence the BALES_HARVESTED table) as well as a running total of bales left at various locations (called stackyards).
When the hay is harvested the BALES_HARVESTED table (a child table of BALES_DATA) is filled out. I’d like the data macros to run and either create a new record in the BALES_STORED table (if the primary key requirements are not met) or edit the number of bales in a record that does have the same composite primary key.
The first step is to determine if there is already a matching key/record in the Bales_Stored table that already contains the composite primary key (composed of Stackyard, Crop, Cutting). If the primary key exists already in the Bales_Stored table then the amount/number of bales needs to be updated (the new bales from the Bales_Harvested table should be added to the count that already exists in the Bales_Stored table.
Else if there is no matching key: if there is not already a record containing the composite primary key in the Bales_Stored table, then a new record should be created in the Bales_Stored table containing the Stackyard, Crop, Cutting, and number of bales.
STACKYARD: a storage location for the bales of hay/alfalfa/grass, etc.
CROP: the type of hay: grass, alfalfa, corn stock, etc.
CUTTING: 1st, 2nd, 3rd, 4th, etc. (1st cuttings for instance are normally better hay than later cuttings).
In the attached database, if you look at the BALES_HARVESTED table I have some ideas for the data macro(s) that I have tried but not succeeded at.
Thank you in advance for any help.
The .jpg is a screen pic of the tables.
the .zip file contains the accdb database
I don't have a form for it yet since I was just entering data into the table to see if I could get it to work (Data Macro's are attached to the table and can't be attached to a form right?). Thanks for checking it out for me.