View Full Version : Duplicate Button


Benny1973
10-05-2005, 09:04 AM
Hi, I wondered if anyone can help me. I can create a button to duplicate data from a form into a subform as below
Private Sub Command159_Click()
'To duplicate work address into preferred address between different forms
Me.Preferred_Address = Form_sfWorkDetails.Company_Name
Me.Preferred_Address_2 = Form_sfWorkDetails.Address
Me.Preferred_Town = Form_sfWorkDetails.Address_2
Me.Preferred_County = Form_sfWorkDetails.Town
Me.Zip_Code = Form_sfWorkDetails.Postcode
End Sub
BUT when I try to duplicate data from a subform to another subform it doesn't work - this is the code below
Private Sub Command160_Click()
'To duplicate work address into notes subform from another subform
Me.Form_ActivityDetails.Company_Name = Form_sfWorkDetails.Company_Name
Me.Form_ActivityDetails.Address = Form_sfWorkDetails.Address
Me.Form_ActivityDetails.Address_2 = Form_sfWorkDetails.Address_2
Me.Form_ActivityDetails.Town = Form_sfWorkDetails.Town
Me.Form_ActivityDetails.Postcode = Form_sfWorkDetails.Postcode
End Sub

I thought I would have had to type Me.Form_subform name.fieldname = Form_subform name.[I]fieldname

I've search this forum for a couple of hours and can't find it posted anywhere, sorry if it is!

ssteinke
10-05-2005, 05:20 PM
I find this (http://www.access-programmers.co.uk/forums/showthread.php?t=66115) FAQ very helpful when trying to reference subforms.

Benny1973
10-06-2005, 03:11 AM
Hi
Thank you for this. I have tried this out on my testing database but it doesn't work. But over the weekend I will try it on the real database and see if it does, fingers crossed. Thanks again