Avatar billede Newbee1 Novice
11. april 2012 - 07:31 Der er 10 kommentarer og
1 løsning

Felt i subform = felt i hoved form

Hej

Kan det lade sig gøre at et felt i en sub form, automatisk bliver udfyldt , med data fra et felt i hovedformular ?


MVH

Tony
Avatar billede larsgrau Forsker
11. april 2012 - 08:59 #1
Hej

Ja det kan det godt

Private Sub feltnavn_Enter()

Me.feltnavn = me.feltnavn med data

End sub

Lars
Avatar billede terry Ekspert
11. april 2012 - 09:15 #2
not sure what the purpsoe of this is Tony, if we assume that a sub form can contain more than one record then why would you want to change the value on the main form each time it gets changed in a sub record?
Avatar billede terry Ekspert
11. april 2012 - 09:15 #3
OOps that wasnt an answer just a question
Avatar billede terry Ekspert
11. april 2012 - 09:39 #4
this is what I was looking for.
http://access.mvps.org/access/forms/frm0031.htm

and that was an answer
Avatar billede Newbee1 Novice
11. april 2012 - 16:36 #5
HI

At.: Lars, jeg kan ikke burge en macro, feltet skal udfyldes automatisk, når hoved er blevet udfyldt.


I have to connect head with sub form, but i dont have 2 fields
to connect.( no fiedls are the same)

So i when I enter data in a field in the head form, i want the same data in the a hidden filed in the sub form ?


Regards

Tony
Avatar billede terry Ekspert
11. april 2012 - 17:22 #6
sounds like bad database design to me

How many records are on the sub form?

If there is no relationship between data on main form and data on sub form how do you show the correct data to show on sub form when you move to another record on main form?
Avatar billede Newbee1 Novice
11. april 2012 - 22:30 #7
Yes you are right


How many records are on the sub form? It depends from 1 to 10?

If there is no relationship between data on main form and data on sub form how do you show the correct data to show on sub form when you move to another record on main form?

Yes that is my problem, when we fill in head form and sub forms, they have to be connected. They are already connected on the date, but there are more than one head forms one each day.


Regards

Tony
Avatar billede terry Ekspert
12. april 2012 - 09:48 #8
Not sure I understand.
"They are already connected on the date, but there are more than one head forms one each day."

If you have only one main record for each day then you should be able to use the date as the realtionship. Just ensure that the date field on the main form/tabel is unique and that it only contains a date not a time, otherwise it will never be unique.


But I suggest you look at youyr table relationships. Uzse the ID column from main form/table as relationship.

http://office.microsoft.com/en-us/access-help/guide-to-table-relationships-HA010120534.aspx
Avatar billede terry Ekspert
12. april 2012 - 09:55 #9
Avatar billede Newbee1 Novice
12. april 2012 - 11:08 #10
HI Terry


I found the answer in the youtube link you send.


Tks

Tony
Avatar billede terry Ekspert
12. april 2012 - 12:03 #11
great, and thanks for the points
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