Help with setting up Data Macro(s) (1 Viewer)

Cdata

New member
Local time
Today, 00:11
Joined
Jul 16, 2010
Messages
5
Hi Folks:

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.

Terms:
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.
Matthew

The .jpg is a screen pic of the tables.
the .zip file contains the accdb database
 

Attachments

  • Farming_Data_05282014_rev211_060220141.zip
    236.2 KB · Views: 105
  • BALES_HARVESTED_BALES_STORED.JPG
    BALES_HARVESTED_BALES_STORED.JPG
    61.5 KB · Views: 104

Users who are viewing this thread

Top Bottom