locked
ms access cannot get active record from subform to textbox data source RRS feed

  • Question

  • Hi,

    I have for many years used the possibility to get active record in a subform to show in a textbox in the main form.

    If I have following naming:

    mainform: frmTestmain

    textbox in main form: txtRecord

    subform as control in mainform: frmTestsub

    subform: frmTestsub

    textbox i subform which value should show up in textbox i main form: CustomerNumber

    I write this in the Control Source of the txtRecord: =[frmTestsub].[Form]![CustomerNumber]

    I get #Name?

    I create a textbox in the subform and name it vRecord and write =[CustomerNUmber]

    Now I get the value in that textbox. It also updates when I change focus on records in the subform.

    Then I try to get this value to the textbox in the main form. But that does not work.

    I am using Access 2013 swedish version. Is there a problem with it?

    /Hans


    Hans Hansson

    Tuesday, February 23, 2016 4:01 PM

Answers

  • well #Name? could always mean a typo or otherwise a naming error.....

    but it could be that the main form opening does not yet get a value from the opening sub form because the sub data isn't yet there

    you can sanity test this by removing the fixed control value so it is unbound in the main form...and instead triggering the value call up from the sub form in an event that takes place later in time such as the user entering a field or possibly the OnCurrent event...  in any case just as a sanity check put the event late where it is clear everything is open and see if you still have the #Name

    Tuesday, February 23, 2016 5:21 PM