Ok, hopefully I can explain this clearly and concisely.
There is a commercial database in my company which I access through an ODBC connection with access. It tracks well production. I have mapped the database and figured out the tables relationships. I have been asked to find production sums for all wells. I can not change the way the data is stored. I tried asking about this problem on a different forum last week, and every answer told me the database was the problem... unfortunately I have no control over that :/
There are 2 tables:
Main
Hist
[MAIN] contains each well and info about the well (location, owner, etc).
[HIST] contains the history of that well (oil, gas, water production, etc)
[HIST] has a row for each year. So my query selects for the current year (2014).
There are twelve fields of interest. prod1$1, prod1$2, prod2$3... prod1$12.
These correspond to jan-dec.
I have to find the first non-zero entry. If production started in march, then prod1$3 would be the first non zero.
The end report requires three things.
Value of the first month of production (first non zero value)
Value of first three months of production summed (sum of first non zero value and the next two sequential months)
Value of first six months of production (sum of first non zero value and next five sequential months).
The only catch is, if there is not enough information to complete a sum (eg: not 6 months worth or values to sum), then it should not sum them at all. Rather it should return a coda like N/A to notify the user this can't be calculated yet.
I don't know if I should be attempting this via query or module. If using a module, the command Recordset.Seek Method (DAO) seemed like it might be useful, but I wasn't able to figure out how to use it. For a query, I had no idea where to start as I have never had to search for data across multiple fields before.
I don't have much experience with creating modules. I have simply found ones that work for other jobs and been able to modify them to fit my needs in the past. I'd say I am medium-level proficient with queries. But I don't know where to start in tackling this issue.
Assistance would be greatly appreciated.