copy value from one subform to another

Posted on 2011-04-29
Last Modified: 2012-05-11
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?
Question by:Shawn
    LVL 84
    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.
    LVL 48

    Accepted Solution

    Don't you mean "if is Null"?
    If IsNull(Me!sbfrmEntitySearchContact.Form![SupplierIDFrance]) Then
      Me!sbfrmEntitySearchContact.Form![SupplierIDFrance] = Me!sbfrmEntitySearchSupplier.Form![SupplierID]
    End If

    Open in new window

    LVL 1

    Author Closing Comment

    thanks gustav. got rid of the NOT and it works fine.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now