AndrewMozley
Programmer
Trying to work out the best way of handling this.
I have a table of currencies, which contains currency_identifier (e.g. EUR), a description (e.g. Euros), an exchange rate (1.42) and a few other things, like the code for a nominal account to which gains / losses on that currency are to be posted.
All installations have a default currency, which is most commonly £ - Sterling - but it does not have to be.
Several tables, like the customer and supplier tables, have a reference to this table in each record - so, there may be suppliers who present their invoices in Euros. For the form which maintains such a table, there is a combo box which allows the user to select a currency; this offers all currencies, including the home currency.
I had rather wanted the currency_identifier to be blank for the home currency. So, on several screens I only wish to display the currency code if it is foreign.
Coming back to the currency table, XCURR.DBF, I had tried to ensure that the currency codes are unique by making the currency identifier (EUR &c) a candidate key. But this creates a problem: when the user wants to create a new currency, I would normally append a blank record to XCURR, start a transaction and then display a form with several text boxes bound to control sources in the XCURR table, until the user says Save or Undo.
But (as I have it currently set up) this causes a problem when I try to APPEND the blank record for editing, since a record with a blank currency-identifier already exists.
What I currently plan is to make the currency_identifier key just a regular index - then when the user clicks on ‘Save, check for a duplicate in that field.
Feel I am making rather heavy weather of this – can anyone think of a better approach - thanks, Andrew.
I have a table of currencies, which contains currency_identifier (e.g. EUR), a description (e.g. Euros), an exchange rate (1.42) and a few other things, like the code for a nominal account to which gains / losses on that currency are to be posted.
All installations have a default currency, which is most commonly £ - Sterling - but it does not have to be.
Several tables, like the customer and supplier tables, have a reference to this table in each record - so, there may be suppliers who present their invoices in Euros. For the form which maintains such a table, there is a combo box which allows the user to select a currency; this offers all currencies, including the home currency.
I had rather wanted the currency_identifier to be blank for the home currency. So, on several screens I only wish to display the currency code if it is foreign.
Coming back to the currency table, XCURR.DBF, I had tried to ensure that the currency codes are unique by making the currency identifier (EUR &c) a candidate key. But this creates a problem: when the user wants to create a new currency, I would normally append a blank record to XCURR, start a transaction and then display a form with several text boxes bound to control sources in the XCURR table, until the user says Save or Undo.
But (as I have it currently set up) this causes a problem when I try to APPEND the blank record for editing, since a record with a blank currency-identifier already exists.
What I currently plan is to make the currency_identifier key just a regular index - then when the user clicks on ‘Save, check for a duplicate in that field.
Feel I am making rather heavy weather of this – can anyone think of a better approach - thanks, Andrew.