Duplicate Button

Benny1973

Benny1973
Local time
Today, 20:09
Joined
Mar 9, 2005
Messages
15
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.fieldname

I've search this forum for a couple of hours and can't find it posted anywhere, sorry if it is!
 
I find this FAQ very helpful when trying to reference subforms.
 
Thank you

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
 

Users who are viewing this thread

Back
Top Bottom