Results 1 to 4 of 4
  1. #1
    Hayley is offline Novice
    Windows 11 Office 365
    Join Date
    Jul 2023
    Posts
    1

    Monthly inventory update query

    I'm working with fish hatchery data and need to produce a query summarizing the monthly data. Part of the summary needs to include the updated inventory for each pond, while keeping the inventory for the previous month visible (I don't want it to overwrite the previous months inventory). I have a table named Inventory that has the starting number of fish for the season and a table named Mortality that identifies the number of mortalities per month. Any guidance for how to do this is appreciated. Example: Raceway_PRAS_Unit 101 has a starting inventory of 70,083. In June 27 fish died, therefore the beginning inventory for July is 70,056. In July 29 fish died, so the beginning inventory for August is now 70,027... and so on. I'm only providing mortality data for one unit to save space.



    Inventory Table
    Raceway_PRAS_Unit Inventory
    101 70,083
    102 70,019
    201 70,024
    202 70,022

    Mortality Table
    Raceway_PRAS_Unit Mortality_Count EOM_Month
    101 27 June
    101 29 July
    101 733 August
    101 396 September

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Hi Haley

    Welcome to the forum

    Not sure that I understand the requirement correctly but the attached file may be of help. Post back with any questions you may have.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Hi Haley

    Can you tell me what your local time was when you made your original post and what part of the world are you in?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    Join Date
    Apr 2017
    Posts
    1,681
    I think this db structure isn't best! You can instead consider something like this:
    tblPonds: PondID, ...;
    tblPopulationChangeTypes: PopulationChangeTypeID, PopulationChangeType, PopulationChangeDirection;
    (PopulationChangeTypes are like "Adding new Fish", "Died Fish", whatever other population changes you need to be registered. PopulationChangeDirection has values 1 for types, used when new fish are added to pond, and (-1) for types used when fish are removed from pond.)
    tblPondPolpulationChanges: PondPopulationChangeID, PondID, PopulationChangeType, PopulationChangeQuantity, RegistrationTime;
    (RegistrationTime can be datetime, or date, or month number (when you use month number, then I advice you use for month numbers a format yyyymm) - you have to decide yourself.)
    And this is all saved data what you need for this particular task. You can use a query to calculate the fish population in any pond for any time moment (Sum all population changes for this pond where registration tome is less or equal to asked time), or a query to calculate quantity changes of certain type for any period (Sum entries for this type for this pond between start and end periods), etc. You don't save those calculated data - whenever you need them, you run the query.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 11-24-2017, 10:57 PM
  2. Replies: 1
    Last Post: 10-25-2016, 03:24 PM
  3. Replies: 15
    Last Post: 09-01-2015, 12:20 PM
  4. Replies: 4
    Last Post: 10-21-2014, 06:06 PM
  5. Replies: 6
    Last Post: 11-10-2012, 09:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums