Avatar billede brobaek Nybegynder
15. juli 2002 - 09:04 Der er 15 kommentarer og
1 løsning

Form : Recordset not updateable

Jeg har to relaterede tabeller, som jeg har proppet ind i en liste (lstALL) på en form (frmALL). Hvis jeg selecter en record på listen (lstALL) og klikker på en edit-knap åbner der sig en form (frmEDIT) med den valgte records egenskaber (rent faktisk lukker formen med frmALL ned først, og åbner så frmEDIT).

Men... jeg kan ikke ændre på data i frmEDIT. Jeg har valgt Allow Edits=yes etc. i properties for frmEDIT.

Hvad pokker har jeg glemt ?
Avatar billede 3xa Nybegynder
15. juli 2002 - 09:23 #1
Jeg ved bare at man ikke kan rette i data der er sorteret i en  forespørgsel...
Avatar billede 3xa Nybegynder
15. juli 2002 - 09:24 #2
Jeg plejer at "appende" til en tabel, hvis jeg skal kunne rette i det... Jeg ved ikke om det er det smarteste, men det virker...
Avatar billede terry Ekspert
15. juli 2002 - 09:30 #3
Cant see your data, if its a linked table make sure you have a primary key! If there is more than one table then your relationships must also be in order!
Avatar billede brobaek Nybegynder
15. juli 2002 - 09:43 #4
Here are a simplified tabel design...

tblInvoice :
Voucher (primary key)
CreditorNo
Amount

tblPartners :
OperatorCode (primary key)
CreditorNo
OperatorName
Avatar billede brobaek Nybegynder
15. juli 2002 - 09:45 #5
Too fast...

CreditorNo in the two tabels are related...

Then I've a list (lstAll) on frmALL which shows all vouchers from tblInvoice and their related OperatorNames... When I choose edit then a form finds the invoice from tblInvoice where voucher is equal to the selected voucher from lstAll.

frmALL closes down and frmEDIT opens with the correct invoice. But I cant update the data...
Avatar billede brobaek Nybegynder
15. juli 2002 - 09:47 #6
Okay, if I remove the OperatorName from the frmEDIT then it works (that is, that the form only shows data from one table).

Can it realy be, that its not possible to relate data on a form and edit it (only edit data from one of the tables) ?
Avatar billede terry Ekspert
15. juli 2002 - 09:51 #7
I am guessing that you are JOINing the two tables in your query, on CreditorNo, but this is NOT a primary key. The creditor No must be a primary key inone of the table and a foreign key in the other
Avatar billede terry Ekspert
15. juli 2002 - 09:52 #8
You CAN relate data and edit it, but there MUST be a correct relationship.
Avatar billede terry Ekspert
15. juli 2002 - 09:57 #9
HOW are you realting the two tables?
Avatar billede brobaek Nybegynder
15. juli 2002 - 10:14 #10
Well, I programmed a solution instead cause CreditorNo cant be a primary key of varius reasons.

They were related like this:
tblInvoice!CreditorNo -------> tblPartners!CreditorNo

(All data from tblInvoices and only from tblPartners where data equals...)

But guess the problem is, that primary key is not CreditorNo...
Avatar billede terry Ekspert
15. juli 2002 - 10:15 #11
Correct!
Avatar billede terry Ekspert
15. juli 2002 - 10:18 #12
The problem with this is that they are BOTH foreign keys, which will return more than one record, and Access cant make a UNIQUE relationship!
tblInvoice!CreditorNo -------> tblPartners!CreditorNo
Avatar billede brobaek Nybegynder
15. juli 2002 - 10:19 #13
Thx...

Even though I dont like the answer ;-)
Avatar billede terry Ekspert
15. juli 2002 - 10:32 #14
Hi brobaek>I can understand that you don like the answer, but points arent given for a happy customer, they are given for a correct answer. Its a hard world sometimes :o)
Avatar billede brobaek Nybegynder
15. juli 2002 - 13:42 #15
Works in a company where customer satisfaction is a big issue in those days... I want that in this forum as well ;-)
Avatar billede terry Ekspert
15. juli 2002 - 13:44 #16
:o) Problem with that approach is that you may not get any answers!
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