In order to select a dataset, I have to run five queries, three of them requiring date parameters, and two which use a date to calculate a week number.
I accept that what I have created is a bit clumsy, and someone with better skills than I possess could probably write a single query to do what I have had to in five, but by creating a macro to run them all, it is effective and it produces the goods, so making it more elegant is not what I am seeking help for right now.
Two of three dates are: EndDate and StartDate (always 181 days prior to the EndDate) and they appear in three of the queries and CalcDate (always 7 days after the EndDate) which appears in the fourth and fifth.
At the moment, I can either hard code them into the statement (this means I have to edit all of the queries each week) or use user parameters prompting the user to provide all the dates (a bit of a fag). I have a solution in mind, but I don't know how to implement it. I would create a table, and create a single field and just one record, namely the EndDate. A query could calculate the other two dates, and I would only have one record to edit; I could either edit the record manually each week, or use a parameter to ask the user to enter the EndDate. However, how would I get the other queries to use these values?
Thanks in advance.
You can stop reading here, unless you want to know what I am trying to achieve...
I want to create a weekly analysis of the value of invoices a list of customers have had and the how much they have paid off their account over the last six months.
Using an ODBC link to the accounts data I get the invoice data in one query, but the receipts data is held in two similar tables, a current and an archive, so I have a query to select the data from one and put it into a table, and another one to append the results from the other into that table.
The last queries use a calculation to summarise the total value of both types of transaction, and allocates a week number, from 26 to the oldest and 1 to the newest.
So now I have two tables of data, I export these into Excel and VBA does an excellent job of lining them up, inserting zero records where there maybe is an invoice value but no payment (or vice versa), calculates a moving balance and creates charts plotting all this data for each of the selected customers.
I accept that what I have created is a bit clumsy, and someone with better skills than I possess could probably write a single query to do what I have had to in five, but by creating a macro to run them all, it is effective and it produces the goods, so making it more elegant is not what I am seeking help for right now.
Two of three dates are: EndDate and StartDate (always 181 days prior to the EndDate) and they appear in three of the queries and CalcDate (always 7 days after the EndDate) which appears in the fourth and fifth.
At the moment, I can either hard code them into the statement (this means I have to edit all of the queries each week) or use user parameters prompting the user to provide all the dates (a bit of a fag). I have a solution in mind, but I don't know how to implement it. I would create a table, and create a single field and just one record, namely the EndDate. A query could calculate the other two dates, and I would only have one record to edit; I could either edit the record manually each week, or use a parameter to ask the user to enter the EndDate. However, how would I get the other queries to use these values?
Thanks in advance.
You can stop reading here, unless you want to know what I am trying to achieve...
I want to create a weekly analysis of the value of invoices a list of customers have had and the how much they have paid off their account over the last six months.
Using an ODBC link to the accounts data I get the invoice data in one query, but the receipts data is held in two similar tables, a current and an archive, so I have a query to select the data from one and put it into a table, and another one to append the results from the other into that table.
The last queries use a calculation to summarise the total value of both types of transaction, and allocates a week number, from 26 to the oldest and 1 to the newest.
So now I have two tables of data, I export these into Excel and VBA does an excellent job of lining them up, inserting zero records where there maybe is an invoice value but no payment (or vice versa), calculates a moving balance and creates charts plotting all this data for each of the selected customers.