TIP: Click on subject to list as thread! ANSI
echo: win_access
to: BILL CHEEK
from: MATTHEW JOHNSON
date: 1996-11-20 19:17:00
subject: QUERY PROBLEM: ACCESS 95

It came to pass on 11/10/96 that BILL CHEEK wrote concerning Query Problem: 
ACCESS 95...
 
BC> I'm suffering from a case of massive brain flatulence and can't for
BC> the life of me, figure out the following dilemma for an ACCESS 95
BC> situation:
BC> Given the following two tables where Table 1 is a list of fruits
BC> grown in a certain county and Table 2 is a list of growers in that
BC> county and their crops:
BC> Table 1                       Table 2 
BC> #===CROP===   ==#===GROWER===CROP1===CROP2===CROP3===CROP4===CROP5=
How much experience do you have designing databases? This is very bad 
design, and you won't be able to generate the query you are looking for 
easily.
You should have three tables
Table 1               Table 2             Table 3
#===CROP===          #===FARMER====     FARMER#===CROP#
1   Apples           1   Smith             1       4      
2   Oranges          2   Jones             1       5
3   Bananas          3   Brown             2       1
4   Figs             4   Davis             3       1
5   Pears            5   Lynne             3       3
                                           4       2
                                           5       1
                                           5       2
                                           5       3
                                           5       4
                                           5       5
There, that is much better design. If you don't understand this then I 
suggest that you get a good book on Relational Database design, and 
preferable not one based on normalisation. Some form of FORM (Formal 
Object Role Modelling) would be good.
From this modified design you should be able to perform your query 
fairly easily. 
Here are some advantages to this design:
1) There is no arbitrary limit to the number of crops that each farmer can 
have.
2) You only need to update the crop type in one place, so if you 
add another type of apple and want to change 'Apples' to 'Granny Smith 
Apples' to be specific, you only need to change it in one place.
3) You can easily query which farmers have a specific type of crop. 
(what you want to do, basically).
Of course this may add a little work to the data entry form (you will 
need to use a subform) but it is essential for good design. If you 
don't do it here and now, you will have problems later on.
Cya Matt               __  _     ____            ____
                 ---+=| =\|=| ==| ===) =========| ===' =============+---
matthewj@gil.com.au   |_|\__|ew |_|\_\esolution |____,ommunications
 * RM 1.31 3332 * Never assume conspiracy where stupidity will suffice.
--- 
(3:640/404)
---------------
* Origin: Past the Black Stump BBS 07-54-656667 Laidley.. Q'land.

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.