Results 1 to 7 of 7
  1. #1
    pcotcamp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    5

    Requerying Navigation Subform after Edit

    All,

    I am relatively new to Access and VBA but have programmed for years in Visual dbase and more recently dBase 8 Plus. The transition has gone very well as I port a legacy 16-bit app over to Access. Until now.


    I have been stuck for several days on getting a form to update a Datasheet contained within a Navigation Subform, after I have saved the edits in the form.

    Based on suggestions elsewhere, I have tried every possible permutation of form names, NavigationSubform names, bangs, dots, OnClose, OnCurrent, AfterUpdate, events etc. and it still will not work.

    To summarize, the hierarchy I am working with is as follows:


    1. Main Menu form: Menu-Main
    2. SubForm1: NavigationSubform1 (tabbed Navigation Form)
    3. Subform2: NavigationSubform2 (tabbed Navigation Form - Contains VendorMain on tab #3)
    4. Form: VendorMain - Form containing a Datasheet based on [Vendors Query] with Add /Edit Command Buttons
    4. Form: VendorForm (Editing form called by VendorMain's Command Buttons)

    **NOTE: I am using overlapping forms and VendorForm is opened as a "standalone" form and not within a subform. VendorForm uses its own query and is not linked to the query of VendorMain. (<--Is this the source of my problem?)

    To be clear:

    Subform1 is tabbed and contains a second tier of Navigation Tabs. Tab #3 is "Operations"

    SubForm2 is also tabbed. Tab #2, "Vendors" contains a link to a form called VendorMain.



    VendorMain contains a Command Button called EditButton.

    EditButton passes the correct record identifier and opens an editing form: VendorForm.

    Upon saving my edits in VendorForm, all I am trying to accomplish is an requery of the Datasheet in Vendormain so that the edits are reflected.

    I have tried placing the Requery command in both VendorMain and VendorForm, in every possible Event. All have failed.

    The obvious(?) choice would be to place the following in the "Save" button's OnClick event in VendorForm: Forms!Menu-Main!NavigationSubform1!NavigationSubform2.Form.Re query

    However, doing so results in an error: "There is no field named Forms!Menu-Main!NavigationSubform1!NavigationSubform2 in the current record."

    Can anyone offer a solution? I am at a complete dead-end here.


    -Paige


    (Please excuse the all-italics. This was copied in from a post in another Access forum.)







  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Navigation Controls are a different animal than, say, a Subform Control. You can access a form in a subform control like this

    Me!Subform1.Form!ControlName

    I have not had any success finding the fully qualified name of a form that resides within a Navigation Control. In other words Me!NavControl.Form!ControlName does not work. I have tried the form name after the NavControl name etc.

    The only thing I have had success with is adjusting the properties of a Nav Control. They have things like Where criteria that you can pass to a form within the Nav control.


  4. #4
    pcotcamp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    5
    Thanks for the input. That makes me feel a little bit better. I thought I was losing my programming mojo.

    Nonetheless, is it possible that Microsoft built the tool such that there is no ability to access/control subforms contained in Navigation tabs? Hard to believe.

    Unless I am really missing a key concept regarding use of Navigation objects, there has to be a way. I had planned this app to have over a dozen forms embedded in Nav Tabs. Now, all of them are "out of reach"?

    Ouch!

    Hopefully someone else here can shed some light on either what I am doing wrong or what I am not understanding about the use of Navigation tabs.

    Paige

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Might I suggest you use a Custom Event to handle this?

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    One approach would be to place a click event inside the Class Module of the form that is contained within the Nav Control. As the user interacts with the subform they can fire this Click event. I have done this before and so it is possible. Of course, it does not have to be a click event. It is merely an example. The TempVars is also an example. However, for things like filters you can reference the Navigation control and the Navigation Button that is associated with the form using fully qualified names. That button has properties that will affect the form, like Where Criteria. The button’s properties are available via Fully Qualified Names.

    Here is the trick. You have to reference the Nav Control from the form's Class Module. I have not goofed around with them for a while but, if you want to requery the form, you have to requery the control that contains the form (if it is possible to Requery). It may be the Nav Control or it may be the buttons (I do not know and maybe someone else has an actual answer). I would practice with the Buttons Properties and then try moving to a Requery (somehow).

    I think the question is how important is the Nav Control to you. I feel it would take Web Forms and interaction with the Back End over a WAN to take advantage of the Nav Control. Otherwise, old school forms are the cat's Meow.

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

Similar Threads

  1. Navigation Form used as SubForm
    By jlgray0127 in forum Forms
    Replies: 2
    Last Post: 03-26-2014, 10:28 AM
  2. Replies: 4
    Last Post: 10-08-2012, 05:33 PM
  3. Search Box Requerying Subform problem
    By cbh35711 in forum Access
    Replies: 1
    Last Post: 03-30-2012, 09:37 AM
  4. Navigation Subform issues
    By bsc in forum Programming
    Replies: 1
    Last Post: 11-29-2011, 11:37 AM
  5. Can I edit a record with a subform?
    By bigmax in forum Forms
    Replies: 0
    Last Post: 08-11-2008, 07:55 AM

Tags for this Thread

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