fboehlandt
09-30-2008, 03:45 AM
Hi everyone,
I have a problem regarding the presentation of data in one of the tables of my database. Let's assume for simplicity's sake the table looks like the following (Fundcode could be the unique primary key):
<Fundname> <Fundcode> <Europe> <America> <Asia> <Other>
<Fund 1> <101> <-1> < 0> < 0> < 0>
<Fund 2> <102> < 0> <-1> < 0> < 0>
<Fund 3> <103> < 0> < 0> <-1> < 0>
<Fund 4> <104> <-1> < 0> < 0> < 0>
etc...
Where Europe, America etc. are regions an investment fund can be invested into. (-1) here denotes that the fund is invested, (0) indicates that the fund is not invested. Thus, those variables are infact binary switch variables (why no check boxes were used is beyond me but the same principle applies). I would like the table to be displayed in a more condensed form:
<Fundname> <Fundcode> <Region>
<Fund 1> <101> <Europe>
<Fund 2> <102> <America>
<Fund 3> <103> <Asia>
<Fund 4> <104> <Europe>
etc...
To make matters worse a given fund can be invested in more than one region, e.g.:
<Fundname> <Fundcode> <Europe> <America> <Asia> <Other>
<Fund 5> <103> < 0> < 0> <-1> <-1>
<Fund 6> <104> <-1> < 0> < 0> <-1>
In which case two or more rows must be included to account for the different regions (this would obviously require a new primary key):
<ID> <Fundname> <Fundcode> <Region>
<1> <Fund 1> <101> <Europe>
<2> <Fund 2> <102> <America>
<3> <Fund 3> <103> <Asia>
<4> <Fund 4> <104> <Europe>
<5> <Fund 5> <105> <Asia>
<6> <Fund 5> <105> <Other>
<7> <Fund 6> <106> <Europe>
<8> <Fund 6> <106> <Other>
etc...
Ideally I would like to implement this as a SQL query but I realize this might be a bit optimistic. I recon a VBA script cannot be avoided but I have no idea how to go about it. Maybe converting the (-1)/(0) entries to checkboxes makes things a bit easier? Any input is greatly appreciated. Thanks in advance
I have a problem regarding the presentation of data in one of the tables of my database. Let's assume for simplicity's sake the table looks like the following (Fundcode could be the unique primary key):
<Fundname> <Fundcode> <Europe> <America> <Asia> <Other>
<Fund 1> <101> <-1> < 0> < 0> < 0>
<Fund 2> <102> < 0> <-1> < 0> < 0>
<Fund 3> <103> < 0> < 0> <-1> < 0>
<Fund 4> <104> <-1> < 0> < 0> < 0>
etc...
Where Europe, America etc. are regions an investment fund can be invested into. (-1) here denotes that the fund is invested, (0) indicates that the fund is not invested. Thus, those variables are infact binary switch variables (why no check boxes were used is beyond me but the same principle applies). I would like the table to be displayed in a more condensed form:
<Fundname> <Fundcode> <Region>
<Fund 1> <101> <Europe>
<Fund 2> <102> <America>
<Fund 3> <103> <Asia>
<Fund 4> <104> <Europe>
etc...
To make matters worse a given fund can be invested in more than one region, e.g.:
<Fundname> <Fundcode> <Europe> <America> <Asia> <Other>
<Fund 5> <103> < 0> < 0> <-1> <-1>
<Fund 6> <104> <-1> < 0> < 0> <-1>
In which case two or more rows must be included to account for the different regions (this would obviously require a new primary key):
<ID> <Fundname> <Fundcode> <Region>
<1> <Fund 1> <101> <Europe>
<2> <Fund 2> <102> <America>
<3> <Fund 3> <103> <Asia>
<4> <Fund 4> <104> <Europe>
<5> <Fund 5> <105> <Asia>
<6> <Fund 5> <105> <Other>
<7> <Fund 6> <106> <Europe>
<8> <Fund 6> <106> <Other>
etc...
Ideally I would like to implement this as a SQL query but I realize this might be a bit optimistic. I recon a VBA script cannot be avoided but I have no idea how to go about it. Maybe converting the (-1)/(0) entries to checkboxes makes things a bit easier? Any input is greatly appreciated. Thanks in advance