Access VBA Run Time Error 2465: Application-defined or object-defined error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prithvi Ragu
    New Member
    • Mar 2014
    • 4

    #1

    Access VBA Run Time Error 2465: Application-defined or object-defined error

    I have a form named UI(Navigation Form) in MS Access 2010. I have two more subforms SEARCH and RESULTS as tabbed forms in UI. After I search in SEARCH form, when I click the RESULTS tab I want the value from a combo box named 'cmbID' in SEARCH to be displayed in a label named 'lblAIPIDDisp' in RESULTS form and then display additional labels. So, I gave the following code in the navigation Button Click Event:

    Code:
    Private Sub NavigationButton32_Click()
    Form_RESULTS.lblAIPIDDisp.Caption = [Forms]![UI]![SEARCH].cmbID.Value
    End Sub
    But I get Run Time Error 2465. So, I tried searching in SEARCH form separately and gave the following code in Form Load Event of RESULTS form:

    Code:
    Private Sub Form_Load() 
    Form_RESULTS.lblAIPIDDisp.Caption = [Forms]![SEARCH].cmbID.Value
    End Sub
    Now, I searched in SEARCH Form and clicked on RESULTS form. I was able to see the value in Combo Box 'cmbID' in SEARCH Form in the label 'lblAIPIDDisp' in RESULTS Form. So, I think there is something wrong in referencing subforms RESULTS and SEARCH in the Navigation Form UI. Help needed in this point.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    Prithvi,
    Let me introduce to my go to place for questions about form-subform references. I'm sure I learned about this page from someone at Bytes, so I'm just paying it forward. This has been a fabulous resource for me.


    I think the one you want is this one:
    Me!Subform2.For m!ControlName
    In your case that would be be ... well, I can't say because I don't know the name of the control that holds your subforms. Note that it's not the name of the subform but the name of the thing that the subform is in.

    Also, be sure to go to the trouble to actively choose names for all of your controls. NavigationButto n32 tells you nothing about the function of that control and when you have been away from the program a while you'll have forgotten all that.

    Jim

    Comment

    Working...