Relationships and dynamically creating entries

I’m a little confused how to set up what I want:

  • There is a database that keeps entries of exercise logs (Exercise) - it gathers a date, and has a number of minutes (which is selected from a drop down of times to select (ie 5m, 10m, 3hrs 15m, etc) from another database (Hours and Minutes). For each label (ie 3hrs) it has a value of minutes in another column (ie 180)).

  • There is another database that keeps entries of sleep time (Sleep) - it also gathers a date and a number of minutes similar to the Exercise database.

  • I’m trying to dynamically add up all of the time (whether from Exercise or Sleep), for a single day - and display it in a bar chart where each bar is a total of time for that day - the sum of Exercise and Sleep minutes.

So, I guess my question is, how can I dynamically create records in another database called 'Total’s where each record has a date and time (that can then be graphed by date and the sum of minutes for that date - from possibly more than one entry) - I can’t seem to get any records to be created into this Total’s database…

Or, alternatively, create a record that has the sum of records for a day (ie a value of 2 if an Exercise record and a Sleep record were submitted in the same day.