Avatar billede jannes Nybegynder
02. marts 2004 - 19:35 Der er 11 kommentarer og
1 løsning

Problemer med relationer

Hej
Jeg har problemer med relationer imellem 5 tabeller. Jeg skal lave et adressekartotek. Jeg har en persontabel med id, fornavn og efternavn. En tabel med oplysninger om arbejde og en med oplysninger om privat. Derudover har jeg til tabellerne "arbejde" og "privat" relateret to tabeller med postnr., så bynavn automatisk skrives.
Når jeg samler alle tabeller i en formular vil den ikke godtage det der skrives. Den skriver, at der mangler en relation i persontabellen.
Avatar billede terry Ekspert
02. marts 2004 - 19:45 #1
Cant see your form but at a guess you need a realtionship between

Persontable and arbejde
and also
Persontable and private
Avatar billede terry Ekspert
02. marts 2004 - 19:48 #2
what do the tables "arbejde" and "privat" contain? If a record is specific for a person then you MUST have a field in these tables which realtes to the person table.
Avatar billede jannes Nybegynder
02. marts 2004 - 19:57 #3
Hej Terry
Jeg har allerede relationer fra persontabellen (id, fornavn, efternavn) til tabellerne Arbejde (id, adresse, tlf., mail) og Privat (id, adresse, tlf., mail). Arbejde-tabellen relatere endvidere til en postnr. tabel. Det samme gør Privat-tabellen. Det er dog ikke samme postnr.-tabel der relateres til, da jeg ikke kunne få det til at virke
Avatar billede terry Ekspert
02. marts 2004 - 20:20 #4
I can take a look if you can send it to NOSPAMeksperten@santhell.dkNOSPAM

remove NOSPAM
Avatar billede jannes Nybegynder
02. marts 2004 - 20:38 #5
Hej Terry. Tak. Jeg sender den til dig.
Avatar billede terry Ekspert
02. marts 2004 - 21:06 #6
Hi Janne, I have received your dB and will take a look now. Its normally a good idea to wait in giving points until you get an answer you can us. I may notbe able to find a solution, or someone could give one before me :o)
Avatar billede jannes Nybegynder
02. marts 2004 - 21:12 #7
Undskyld, men det er første gang jeg bruger eksperten.dk.
Avatar billede terry Ekspert
02. marts 2004 - 21:16 #8
Yes I see :o) and welcome
Avatar billede terry Ekspert
02. marts 2004 - 21:42 #9
OK, I've had a look at your database.

Your relationships are totally wrong! The primary key in Person table is an autonumber, this is OK. The primary key in PrivatAdresser is also an autonumber. This again is OK, BUT!!!!! you are using the primary key in this table as the relationship to the person table, whcihjsut WILL NOT work.

Make a new field in PrivatAdresser, when you choose the data type for this field you will see one named "lookup wizard" or something like that. Choose the type for the new field and follow the instructions. This will create a "foreign key" to the person table.
Take a look at the realtionship from the PrivatAdresser table to postnr-privat, this is how it should be.

The same problem applies for Arbejdsadresser, again you are using the autonumber (primary key) as the foreign key to person!

When you have done this you need to make a form for Arbejdsadresser and one for Privatadresser. Then drag and drop these two forms onto the form for person. This will give you two sub forms on the person form.

Sounds like a lot of work, but I'm sorry to say it is necessary or you will not got it working!


but if you only want ONE private address and ONE work address then the fields in these two tables should be in person!
Avatar billede terry Ekspert
02. marts 2004 - 21:43 #10
whcihjsut WILL NOT work. = which WILL NOT work.
Avatar billede terry Ekspert
02. marts 2004 - 21:45 #11
If you need further help then send me a mail and I will get back to you.

It is important that the table design is correct BEFORE you make your forms!
Avatar billede jannes Nybegynder
02. marts 2004 - 21:46 #12
tak Terry. Det vil jeg prøve. Ja, det lyder som en del arbejde, men hvis det løser problemet gør det ikke noget.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester