Hello,
I've been trying for a couple of weeks to solve an issue with the design of a new database in Access 2010. I'm new-ish to database design but have been an end-user of Access for many years (mostly A'97 though).
Essentially I am duplicating a "database" that has been created, stored and used in Excel over many years. The idea is to duplicate it, run both in parallel and then phase out the obsolete Excel file.
One field that has got me scratching my head is a "re-categorise" field. In Excel this is a whole bunch of nested IF statements to convert a sales channel from the computer generated string to a new string based on certain criteria.
For example, if the sales channel is "Open Auction" and the buyer code is "011111A" then the new category is "Auctions Ireland".
Unfortunately not all the IFs use the same determination category, and some have lookups to check if they are contained within another table and act accordingly.
Also unfortunately, I cannot change the way the raw input data is generated.
To give a couple more examples in sloppy Excel paraphrasing:
IF [SalesChannel] = "Open Auction" AND [BuyerCode] = "099999Z" THEN "Special Buyer"
IF [SalesChannel] = "ABC-Chan" THEN LOOKUP [MainTable].[VIN] against [ExtraTable].[VIN], return [ExtraTable].[NewChannel] ((if value not found, return "Direct Sale"))
...and so on.
I have 8 different values of [SalesChannel] that need to be converted to 13 possible results with max of three possible outcomes per [SalesChannel] value, on a table with ~30k records.
There are two [SalesChannel] values that need to be checked against a separate table each, and whether or not a certain field is found within that other table determines the outcome.
Preferably I am looking to:-
Does anyone that can decipher my blabbering have any ideas on how/if this is possible? I have tried a few things but as I said I am inexperienced with creating databases; however I have a good idea of how they work and a basic grasp of VBA (but not SQL).
Thanks in advance!!
I've been trying for a couple of weeks to solve an issue with the design of a new database in Access 2010. I'm new-ish to database design but have been an end-user of Access for many years (mostly A'97 though).
Essentially I am duplicating a "database" that has been created, stored and used in Excel over many years. The idea is to duplicate it, run both in parallel and then phase out the obsolete Excel file.
One field that has got me scratching my head is a "re-categorise" field. In Excel this is a whole bunch of nested IF statements to convert a sales channel from the computer generated string to a new string based on certain criteria.
For example, if the sales channel is "Open Auction" and the buyer code is "011111A" then the new category is "Auctions Ireland".
Unfortunately not all the IFs use the same determination category, and some have lookups to check if they are contained within another table and act accordingly.
Also unfortunately, I cannot change the way the raw input data is generated.
To give a couple more examples in sloppy Excel paraphrasing:
IF [SalesChannel] = "Open Auction" AND [BuyerCode] = "099999Z" THEN "Special Buyer"
IF [SalesChannel] = "ABC-Chan" THEN LOOKUP [MainTable].[VIN] against [ExtraTable].[VIN], return [ExtraTable].[NewChannel] ((if value not found, return "Direct Sale"))
...and so on.
I have 8 different values of [SalesChannel] that need to be converted to 13 possible results with max of three possible outcomes per [SalesChannel] value, on a table with ~30k records.
There are two [SalesChannel] values that need to be checked against a separate table each, and whether or not a certain field is found within that other table determines the outcome.
Preferably I am looking to:-
- Avoid lots of confusing nested IIF statements
- Have the re-category field as a query result i.e. not a calculated field in the main table
- Have the re-categorisation rules stored in a table so that they can be changed and/or added to easily (unlike nested IIFs)
Does anyone that can decipher my blabbering have any ideas on how/if this is possible? I have tried a few things but as I said I am inexperienced with creating databases; however I have a good idea of how they work and a basic grasp of VBA (but not SQL).
Thanks in advance!!