bcmarshall
Registered User.
- Local time
- Today, 08:01
- Joined
- Jul 17, 2010
- Messages
- 96
I have an Access 2007database, SQL Server , 20 users for an insurance company that has been established for more than 4 years and is working well. There was a serious error made when it was originally set up. Each insurance company was assigned its own field with its own name as a place to store their rates.
This has become increasingly unwieldy as companies are added to or dropped from our roster, and I'm in the process of tearing the existing system out by the roots and replacing it with a system that will allow the companies to be drawn from a table.
This is a very complex description, but I think it's critical to understanding what my actual issue is.
I've selected an unusual approach to this, creating 16 fields in the database whose names are the numbers 1-16. Those fields are money datatypes, and will be where the competing premiums for different companies will be stored. This will allow me to minimize the number of fields employed and give me maximum flexibility.
We sell specialty insurance for toys, primarily RV's, boats, motorcycles, and some autos as well. Some companies may write policies for one vehicle type but not another, and by using the numbered field approach that same field can hold data for one insurance company for one vehicle type, and for another company for another vehicle type.
As a company is entered into the table, there are checkboxes to select the vehicle type that it sells policies for. The same company is assigned a different ordinal number (based on DMax+1) for each vehicle type it sells. Suppose that the same company is the third boat insurer entered, the fifth motorcycle insurer, and the eighth RV insurer. That company would them have the ordinal number of 3 for boats, 5 for motorcyles, and 8 for RV's. The values for those vehicles will be stored in fields 3, 5, and 8 respectively. Same company, three fields. It seems crazy, but in fact it's an efficient use of limited table field real estate. The computer can easily do a lookup of the ordinal for a given company based on vehicle type, and know which field to find the data in, so it's really not too extreme.
Now to get to the reason I'm writing.
I have a pop-up form that is used for recording competing company quotes. I've written a routine that counts the number of companies in the query and makes only that number of fields visible out of a total of 16. The problem is that I want to display the companies on that form in alphabetical order.
Each query that returns the companies for a given vehicle type has a sequential counter field in it which indicates the alphabetical order of the entries. It's another number field, but it's completely unrelated to the ordinal ID number.
Let's assume we have three companies for a given vehicle type, Progressive, Dairyland, and Foremost and give them the ID numbers of 8, 6, and 2. The alphabetical sequence for the same companies would be 3, 1, and 2.
Under this scenario, I want the control source of the field at the top to be the field called "6", but I can't assign that because suppose we add in BlueSky tomorrow. It now becomes the alphabetical leader, even if its ordinal ID is 9. For that reason, I'm searching for an expression that I can use to set the value of the control source depending on the sequential value returned by the query.
I tried DLookup("[Ordinal]","[RVIns]","[Seq]=1") (seq being the alphabetical first field), with and without an =, with and without enclosing it in Eval(), and the best I've accomplished is to fill in the field with the desired number as data, or a Name error.
How can I write an expression that Access will understand that will assign that control to a table field called "9" instead of a value of 9? The desired field is in the drop-down on the control source.
This has become increasingly unwieldy as companies are added to or dropped from our roster, and I'm in the process of tearing the existing system out by the roots and replacing it with a system that will allow the companies to be drawn from a table.
This is a very complex description, but I think it's critical to understanding what my actual issue is.
I've selected an unusual approach to this, creating 16 fields in the database whose names are the numbers 1-16. Those fields are money datatypes, and will be where the competing premiums for different companies will be stored. This will allow me to minimize the number of fields employed and give me maximum flexibility.
We sell specialty insurance for toys, primarily RV's, boats, motorcycles, and some autos as well. Some companies may write policies for one vehicle type but not another, and by using the numbered field approach that same field can hold data for one insurance company for one vehicle type, and for another company for another vehicle type.
As a company is entered into the table, there are checkboxes to select the vehicle type that it sells policies for. The same company is assigned a different ordinal number (based on DMax+1) for each vehicle type it sells. Suppose that the same company is the third boat insurer entered, the fifth motorcycle insurer, and the eighth RV insurer. That company would them have the ordinal number of 3 for boats, 5 for motorcyles, and 8 for RV's. The values for those vehicles will be stored in fields 3, 5, and 8 respectively. Same company, three fields. It seems crazy, but in fact it's an efficient use of limited table field real estate. The computer can easily do a lookup of the ordinal for a given company based on vehicle type, and know which field to find the data in, so it's really not too extreme.
Now to get to the reason I'm writing.
I have a pop-up form that is used for recording competing company quotes. I've written a routine that counts the number of companies in the query and makes only that number of fields visible out of a total of 16. The problem is that I want to display the companies on that form in alphabetical order.
Each query that returns the companies for a given vehicle type has a sequential counter field in it which indicates the alphabetical order of the entries. It's another number field, but it's completely unrelated to the ordinal ID number.
Let's assume we have three companies for a given vehicle type, Progressive, Dairyland, and Foremost and give them the ID numbers of 8, 6, and 2. The alphabetical sequence for the same companies would be 3, 1, and 2.
Under this scenario, I want the control source of the field at the top to be the field called "6", but I can't assign that because suppose we add in BlueSky tomorrow. It now becomes the alphabetical leader, even if its ordinal ID is 9. For that reason, I'm searching for an expression that I can use to set the value of the control source depending on the sequential value returned by the query.
I tried DLookup("[Ordinal]","[RVIns]","[Seq]=1") (seq being the alphabetical first field), with and without an =, with and without enclosing it in Eval(), and the best I've accomplished is to fill in the field with the desired number as data, or a Name error.
How can I write an expression that Access will understand that will assign that control to a table field called "9" instead of a value of 9? The desired field is in the drop-down on the control source.