Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2014
    Posts
    4

    Unanswered: Path to Subform Control - control name misspelled or refers to control doesn't exist

    Hello DBForum,

    This is my first post so please go easy

    (I searched for similar threads but didn't find any related to what I'm looking for)

    I believe my problem should be simple to resolve but I have tried every variation I can think of and am still stuck.

    I am trying to modify the MS Access "Contacts" Web database Microsoft provides as a Template. I have added another level of the forms already displayed - basically when the NewForm command button is clicked a new "Main" form opens with the same structure of the original (nvcNavigationControl, NavigationSubform, sfrNameList and DS).

    My issue is that on the new form I cannot reference a Command Button on the NavigationSubform from the "On Click" event in the sfrNameList Subform.

    Basically, when I click a "Contact" in the sfrNameList I want to Enable the Command Button - EditDetails (which I have set to Disabled when the form opens).

    Searching on Google I have found the below as the format that should be used to reference a Subform but am unable to get it to work.

    Forms!YourMainFormName.YourSubformControlName.Form .YourControlName

    Which in this case would translate to:

    Forms!Main.NavigationSubform.Form.cmdEditDetails

    However, I still receive the same error that the Control name is misspelled or does not exist. I have provided some print screens which I hope will help explain the issue.

    Any help is truly appreciated!

    Thank you in advance!
    Attached Thumbnails Attached Thumbnails Main Form.jpg   NewForm.jpg  

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I have my doubts about
    Forms!Main.NavigationSubform.Form.cmdEditDetails
    Id try:-
    Forms!Main!NavigationSubform!cmdEditDetails.enable d = true
    unless you have a sub sub form called form that is. And if you did I suspect that using a reserved word for an object could well be causing problems


    as to whether you should use a full stop or an excalamtion mark between properties this suggests:-
    Exclamation point or period - which do I use and when?

    There is a basic rule to follow here; if you name something yourself then use the exclamation point, if Access has named something then use the period. For example, form names and control names need an exclamation point. Properties need a period.

    If you use the Expression Builder, the punctuation is filled in for you when you select a control or property, together with the names of the objects and controls.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2014
    Posts
    4

    Still no luck...

    Hi Healdem,

    Thanks very much for your reply and the link/advice on exclamation points vs. full stop - I was wondering about that also...

    However, I tried your suggestion and I am still having no luck...

    Any other ideas???

    Much appreciated!!

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so if its still telling you there is a problem then check that you do actually have a parent form called main
    an embedded from called NavigationSubform
    and a control called cmdEditDetails on the form called NavigationSubform

    its fairly easy to to check whch element is failing

    put a breakpoint on the code at
    Code:
    Forms!Main!NavigationSubform!cmdEditDetails.enabled = true
    when the code halts
    move the mouse pointer over each element working from left to right
    or in the immdiate window
    ?forms.count
    ?forms.main.count
    ?forms.main.NavigationSubform.count
    ?Forms!Main!NavigationSubform!cmdEditDetails.value
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Feb 2014
    Posts
    4
    Hi again,

    So if you haven't guessed I am fairly new to this DB world and Access in particular. The web form has an Embedded Macro which I managed to convert to Visual Basic, which now shows:

    DoCmd.SetProperty "Forms!Main!NavigationSubform!cmdEditDetails", acPropertyEnabled, "-1"

    I was also able to add a breakpoint as you suggested...

    However, when I attempt to run it in the VB Window I get the following error:

    "There is no current code context object"

    Again, I am sure this is something simple I am missing but thanks again for your help! ... (and patience).

  6. #6
    Join Date
    Feb 2014
    Posts
    4

    Solved

    Hi Again,

    Just to close this thread off, I found a way around the problem by redesigning the form.

    Thanks again for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •