Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Form Field to Subform Field 1

Status
Not open for further replies.

Pistol

MIS
Jan 29, 2001
59
0
0
US
I'm trying to copy information from a field in a form to a field in a subform (all within the current record).

Here's what I have been using to accomplish the same thing between two fields within the same form.

Me.ShipToCustomerName = Me.SoldToCustomerName

I know I have to name the form in the code, but I can't get the syntax down.

Me.forms.form1.ShipToCustomerName = Me.forms.form2.SoldToCustomerName

any suggestions?

Thanks in advance.
 
The correct statement will look something like this:

Me.ShipToCustomerName = Me.MySubFormObjectName.Form!SoldToCustomerName

HTH

Joe Miller
joe.miller@flotech.net
 
Thanks for your help, but I still can't get it to work. Here is some more information:

I have a form called "FRM_RMA_MAIN" it has a subform called "SUBFRM_ACTION" on the event that a user clicks on the "Send replacement option" on the subform (SUBFRM_ACTION) the shipping information (for the current record) in the main form (RMA_MAIN_FRM) is copied over. The source for "FRM_RMA_MAIN" is a table called "TB_RMA", the subform is based on a query from "TB_ACTION". There is a "One-To-Many" relationship between the tables, and forms. Here is the code based on your example.

***********************************************************
Private Sub InOpSndReplace_Click()
Me.ShipToNameAWReplacement = Me.FRM_RMA_MAIN.Form!ShipToCustomerName
End Sub
***********************************************************

Using this, or reversing the order, I get a "Compile Error" "Method or data member not found"

Any other suggestions?
Thanks

Peter McLernon
pmclernon@us.belimo.com


 
Ok, so the button is in the SubForm and not in the Main form, that's where the confusion lies.

Change the code to this and see if it works better:

Me.ShipToNameAWReplacement = Forms!FRM_RMA_MAIN.ShipToCustomerName Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top