Copy fields in subform and paste in another one

falcondeer

Registered User.
Local time
Today, 12:34
Joined
May 12, 2013
Messages
101
Hi

I need to be able to copy fields from subform-1 and paste them in same fields in subform-2 when I update a comb box in subform-2 using VBA.

Please see the below picture

Thanks
 

Attachments

  • Picture 1.png
    Picture 1.png
    118.3 KB · Views: 136
See same discussion here

IF your button is on the main form then your syntax is something like

Me.SubForm2Name.FORM.Size = Me.Subform1Name.FORM.Size
....
 
If you want the code to be called from Subform2 then
Me.Size = Me.PARENT.Subform1Name.FORM.Size
 
If you want the code to be called from Subform2 then
Me.Size = Me.PARENT.Subform1Name.FORM.Size
Error 2465 happened, this is my code:

Private Sub PROV_Status_AfterUpdate()

If Me.PROV_Status.Value = "Requisted Item given" Then
Me.PROV_Size = Me.Parent.tblPrescribedItems.Form.PR_Size
Else: End If

End Sub
 
Can you try:

Private Sub PROV_Status_AfterUpdate()

If Me.PROV_Status.Value = "Requisted Item given" Then
Me.PROV_Size = Me.Parent!tblPrescribedItems!PR_Size
Else: End If

End Sub
 
Is that meant to be Requested Item given?
 
Can you try:

Private Sub PROV_Status_AfterUpdate()

If Me.PROV_Status.Value = "Requisted Item given" Then
Me.PROV_Size = Me.Parent!tblPrescribedItems!PR_Size
Else: End If

End Sub

Sorry to say it but I got the following error: MS Access can't find 'tblPrescribedItems' referred to in your expression

By the way all those fields are a combo box fields including PROV_Size and PR_Size
 
I can't help thinking your structure is all wrong.?

What it you need Accessory4?

Normally you would just use an ID field that identfies that accessory, select it and any descriptive data comes in from it's table?, not copy descriptive data all over the place?
 
I can't help thinking your structure is all wrong.?

What it you need Accessory4?

Normally you would just use an ID field that identfies that accessory, select it and any descriptive data comes in from it's table?, not copy descriptive data all over the place?
Thank you, its only 3 accessories there is no 4th, and I just don't want the user to fill same fields again when the "Requested Items are given" but if "Different item is given" then the user have to fill different item with its different accessories.

So again I wanted to find a way to fill all the fields in subform2 (tblProvidedItems) when "Requested Items Given" is chosen instead of filling them manually again.

May be you are right and my db is not well designed from the beginning but this is the best I could do.
 
Sorry to say it but I got the following error: MS Access can't find 'tblPrescribedItems' referred to in your expression
you need to investigate the Real Name of that subform by going on design view of your form, clicking on that subform and
looking at Property Sheet->Other->Name.

then substitute the Real name to the code i gave you.
 
you need to investigate the Real Name of that subform by going on design view of your form, clicking on that subform and
looking at Property Sheet->Other->Name.

then substitute the Real name to the code i gave you.
Thanks
 
I struggle to see why you would want to copy fields from a sub from to another. It just sounds like a data structure problem. Generally, which fields in subform1 would be relevant to subform2 - that would need a copy? I just can't see this.
 

Users who are viewing this thread

Back
Top Bottom