• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

copy value from one subform to another

I have 2 subforms side by side with a button in the middle. Once I select a record in each subform I want to click on the button and have it copy a supplier code from one subform to the other.

Right now this is what I have under the button:
If Not IsNull([sbfrmEntitySearchContact].Form![SupplierIDFrance]) Then
[sbfrmEntitySearchContact].Form![SupplierIDFrance] = [sbfrmEntitySearchSupplier].Form![SupplierID]
End If

It doesn't seem to do anything though...when I say select I mean I just click on each record so I can see the arrow on the record selector of each subform.

Any ideas?
0
Shawn
Asked:
Shawn
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
So you have two subforms, each of which is hosted by another form (i.e the "parent")? If so, then you must use syntax like this to refer to SubfromB from SubformA:

Me.Parent.SubformB_SubformControlName.Form.SupplierID = Me.SupplierID

Note "SubformB_SubformControlName" - this is the name of the Subform CONTROL hosting your second Subform, and may or may not be named the same as the form you're using as a Subform.
0
 
Gustav BrockCIOCommented:
Don't you mean "if is Null"?
Then:
If IsNull(Me!sbfrmEntitySearchContact.Form![SupplierIDFrance]) Then
  Me!sbfrmEntitySearchContact.Form![SupplierIDFrance] = Me!sbfrmEntitySearchSupplier.Form![SupplierID]
End If

Open in new window


/gustav
0
 
ShawnAuthor Commented:
thanks gustav. got rid of the NOT and it works fine.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now