By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

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

P: 4
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub NavigationButton32_Click()
  2. Form_RESULTS.lblAIPIDDisp.Caption = [Forms]![UI]![SEARCH].cmbID.Value
  3. End Sub
  4.  
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load() 
  2. Form_RESULTS.lblAIPIDDisp.Caption = [Forms]![SEARCH].cmbID.Value
  3. End Sub
  4.  
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.
Apr 10 '14 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,221
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.
http://access.mvps.org/access/forms/frm0031.htm

I think the one you want is this one:
Me!Subform2.Form!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. NavigationButton32 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
Apr 10 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.