Hello all,
My apologies in advance for such a long post, but I really want to make clear exactly what my problem is, I'm sure that there is a relatively simply solution to this...
We have an incredibly old SOP system which contains data regarding orders that are required for the running of our Access DBMS. To use the data in Access we download batches of data into CSV files and then twice daily append/update these records to a table in the Access file for use with the queries in there. This all works fine and has done for some months now. However, we have now got to the point where we need to analyse some of the data in monetary terms. The problem is that monetary values in the SOP data are stored as a currency format and the actual currency is stored in a separate field of the same table, which simply stores a string denoting the currency; there are three of these: GBP, EUR and USD.
The data that is to be reported needs to be summed and displayed in GBP, and so I am looking to convert the values to GBP in the Access table that stores the SOP data, so when the reports are run it is just a matter of summing the values, rather than slowing the queries down by performing the calculation in them every time that the report is run. Reports will always be run at least a week after the previous month has ended and so my plan is to create a table which stores the conversion rates, which would then be updated manually as soon as the new rates are available (usually around the second working day of the month). This table would contain the start and end date of the month and the conversion rate for EUR and USD.
Each record in the Access table has an invoice date associated with it and so I could then run an update query (in with the existing queries that are run twice daily) that for each record finds the appropriate date range and calculates the currency value to be GBP (by looking up the currency and then finding the conversion rate for that month). The result can then be stored in a new field (which defaults to zero), and this new value can be summed on the reports.
My question is this: what is the best way to structure this update query? I'm not sure how to go about it. It almost needs to iterate through each record in the Access table and for each record loop through the date ranges in the currency table until an exit criteria of >=Start Date AND <= to End Date is met. How would I do this in a query? Or is there another way of achieving the same result in a query?
Thank you for taking the time to read this post and please offer some suggestions, as I am stuck for ideas!
Matthew
My apologies in advance for such a long post, but I really want to make clear exactly what my problem is, I'm sure that there is a relatively simply solution to this...
We have an incredibly old SOP system which contains data regarding orders that are required for the running of our Access DBMS. To use the data in Access we download batches of data into CSV files and then twice daily append/update these records to a table in the Access file for use with the queries in there. This all works fine and has done for some months now. However, we have now got to the point where we need to analyse some of the data in monetary terms. The problem is that monetary values in the SOP data are stored as a currency format and the actual currency is stored in a separate field of the same table, which simply stores a string denoting the currency; there are three of these: GBP, EUR and USD.
The data that is to be reported needs to be summed and displayed in GBP, and so I am looking to convert the values to GBP in the Access table that stores the SOP data, so when the reports are run it is just a matter of summing the values, rather than slowing the queries down by performing the calculation in them every time that the report is run. Reports will always be run at least a week after the previous month has ended and so my plan is to create a table which stores the conversion rates, which would then be updated manually as soon as the new rates are available (usually around the second working day of the month). This table would contain the start and end date of the month and the conversion rate for EUR and USD.
Each record in the Access table has an invoice date associated with it and so I could then run an update query (in with the existing queries that are run twice daily) that for each record finds the appropriate date range and calculates the currency value to be GBP (by looking up the currency and then finding the conversion rate for that month). The result can then be stored in a new field (which defaults to zero), and this new value can be summed on the reports.
My question is this: what is the best way to structure this update query? I'm not sure how to go about it. It almost needs to iterate through each record in the Access table and for each record loop through the date ranges in the currency table until an exit criteria of >=Start Date AND <= to End Date is met. How would I do this in a query? Or is there another way of achieving the same result in a query?
Thank you for taking the time to read this post and please offer some suggestions, as I am stuck for ideas!
Matthew