Results 1 to 7 of 7
  1. #1
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202

    How to reference qry criteria based on a Navigation form's sub sub form

    I have a Navigation form (frmNavMain) with several tabs (form was created using Create>Forms>Navigation). Under one of the tabs, there is a form (frmTALog). Within that form is a subfrm (subfrmTALog). I am attempting to reference one of the fields in the subfrmTALog [EmployeeID], to a criteria in a query as to pull up only that employee's information. Using standard format for referencing a form within the query:

    [Forms]![frmNavMain]![frmTALog]![subfrmTALog]![txtEmployeeID]



    Does not seem to work. Is there something in the navigation forms I am missing? Any help would be appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    use the BUILDER, to get the path correct. its will look more like:

    [Forms]![frmNavMain]![frmTALog]!form![subfrmTALog]!form![txtEmployeeID]

  3. #3
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    Thank you for your reply, unfortunately, this didn't work. I tried the builder, but it does not see the subform or subsubform. I even tried to reference the tab ([NavLogTA]) first with different possibilities. Correction in my first note: not frmTALog and frmLogTA not frmLogTA and subfrmLotTA. Corrections are made below.


    [Forms]![frmNavMain]![frmLogTA]!form![subfrmLogTA]!form![txtEmployeeID]
    [Forms]![frmNavMain]![NavLogTA]![form]![frmLogTA]![subfrmLogTA]![txtEmployeeID]
    [Forms]![frmNavMain]![NavLogTA]![form]![frmLogTA]![form]![subfrmLogTA]![txtEmployeeID]
    [Forms]![frmNavMain]![form]![frmLogTA]![form]![subfrmLogTA]![txtEmployeeID]

    any other suggestions?

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    The syntax for a subform on a form on a navigation form seems different to me. Here it is with generic id's/names and not attempting to use your names. The bold text is to be verbatim, and doesn't change according to your naming of form objects (NOTE - if you did not change the default name for the navigation form, it is actually called Navigation Form):

    [Forms]![Navigation Form]![NavigationSubform].[Form]![SubFormControlName]![ControlNameOnSubform]

    Every form on the navigation form is considered a subform and is referenced as [NavigationSubForm], same as we use [Form] to refer to a subform in a normal subform control.

    SubFormControlName is the name of your subform control on the form. Access will default this to be the same name as the subform itself if you use a wizard to create the form/subform. This I don't allow.

    ControlNameOnSubform - this one should be obvious.

    So to play with this for you, I created some quick and dirty objects, not worrying too much about their names. I have a navigation form (used default name of "Navigation Subform") with Form7 on a tab. Form7 has a subform on it. The Form7 subform control is named Child0. DSID is a control on the subform. This works when Form7 is the loaded form in the navigation form:
    [Forms]![Navigation Form]![NavigationSubform].[Form]![Child0]![DSID] (value returned is 888).

    Be aware that a navigation form only has one form loaded at any time. You cannot refer to any form or control on another form if it isn't the active form at the time. Hopefully that is not your underlying problem.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    Thank you everyone for you responses. Through much trial and error (mostly error on my part) I have figured out why the builder was not working for the reference.
    1. The Navigation form is comprised of multiple sub forms and can go multiple subforms deep.
    2. The layout for the Navigation form is as follows.
    a. [frmNavMain]=Main navigation form
    b. [subfrmMain] = The navigation form is comprised initially of a subform we will call subfrmMain. This subform DOES NOT have a tab connected to a form. This form is to place all the other subsubforms.
    c. Tabs: The tabs at the top of the subfrmMain will guide you to open subsubforms within the [subfrmMain]. Each tab has a Navigation Target Name in it's Property Sheet. This is where you will place the form the tab open when clicked.
    d. [subsubfrm]= The subsubfroms are connected to the tabs.
    e. [subsubsubfrm]...will you get the idea now.
    3. The builder was not working for me as you must have the tab clicked and the forms you are referencing open in either Design view or Layout view. From there, you can go to your qry and use the builder. When using the builder, I realized that I needed expand the levels under the Expression Elements and not just click them. Example:Expression Elements>Forms> Loaded forms> and then all the way to the sub forms I want to look for my control. Then click on that control.

    In the end this was my formula: Forms![frmNavMain]![frmMain].Form![txtEmployeeID]

    Anyone have an idea as to how or why it bypassed all the subforms? It works and I am not complaining, but don't understand.
    Again, Thank you all for your help.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    Just my $.02 worth. This example is why I avoid the navigation form. When it first appeared (in Access 2007?), I thought it was something wonderous that Microsoft had bestowed on a grateful user base.
    So, I tried it out on a project. As soon as I began trying to navigate the Nav/Form/subform structure I ran into trouble. And trouble. And more trouble.
    I went back to the old form/subform or form/tabcontrol setup and my troubles went away. As far as I'm concerned the Nav form construct went away too.

  7. #7
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Anyone have an idea as to how or why it bypassed all the subforms?
    I'm not sure you have the hierarchy right. I tried to follow your explanation but it seems that you initially refer to an element by one name, then another. Since you renamed your objects rather than accept the default names, I'm not sure exactly what the structure is. One thing that can help clear it up is, if we consider only one form that gets loaded by a tab, does that form have a subform on it or not? My example was structured for a form/subform duo that gets loaded into a tab. I thought that's what you were saying you had, but now I'm not sure.

    I may not be able to get back to this until Monday or Tuesday.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 09-14-2015, 09:38 PM
  2. Reference Form when using Navigation Form Access
    By pritesharyan in forum Access
    Replies: 3
    Last Post: 05-12-2015, 03:30 AM
  3. Reference Subform on Navigation Form
    By GOP in forum Forms
    Replies: 1
    Last Post: 07-30-2014, 08:18 AM
  4. Subform Reference on Navigation Form
    By rts in forum Forms
    Replies: 1
    Last Post: 06-05-2012, 02:05 PM
  5. How to reference a form in the Navigation Form
    By HarryScofs in forum Access
    Replies: 3
    Last Post: 08-18-2011, 04:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums