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

Code error that nested form control not found

P: 3
I have a nested forms 5 deep. The code is on the After Update event of a combo box control on the 1st Parent form. The intention is that when a user selects #2 from the drop-down on that first form, that certain controls in the nested forms will be disabled. The code works correctly for all of the controls except for the ShopName control (the last in the list). If I add a " ' " to the front of the line to make it a note, everything else works. The controls are all on the same subform and I've double-checked to make sure the control name is correct. Please help!

Expand|Select|Wrap|Line Numbers
  1. Private Sub FileType_AfterUpdate()
  2. If (Me.FileType = "2") Then
  3. Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage.Form!sfrmEstimate.Form!Days.Enabled = False
  5. Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage.Form!sfrmEstimate.Form!TotalLoss.Enabled = False
  7. Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage.Form!sfrmEstimate.Form!lbPartCo.Enabled = False
  9. Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage.Form!sfrmEstimate.Form!Command24.Enabled = False
  11. Me!sfrmInspection.Form!sfrmLocation.Form!frmDamage.Form!sfrmEstimate.Form!ShopName.Enabled = False
  12. End If
  13. End Sub
Thank you so much!
Aug 16 '12 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 3,284

Try renaming the text box to txtShopName and then point to that control in your code (as a reminder, please use the code tags when you post).

This "should not" be the cause of the error, but I find it is always a good practice to name the control on the form with a prefix (such as txt for a text box or cbo for a combo box), that way you (and others coming after you) are clear that you are talking about hte control and not the field underlying the control.

I don't know if this will fix it, but give it a try. Stranger things have happened in Access.....
Aug 16 '12 #2

P: 3
Thanks for the tip. This db has been a long time in the works and so as I've begun to learn more, I've adapted some of these tips but my biggest concern in going back through and renaming is that it will then create a problem for other code that I have running. I don't know of a way to go back through and search every instance of where that control name would be in my db to update them also.

Aug 16 '12 #3

Post your reply

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