Results 1 to 9 of 9
  1. #1
    jgm835 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    5

    Form events in NavigationSubform not working

    I have a NavigationForm (Access 2016, Windows 10) with 4 Horizontal tabs with subforms.
    If I open the Subforms independently (not within the NavigationForm) all the form events work properly.
    However when I open the NavigationForm and switch from one NavigationSubform to another, the form events do not work.
    My specific need is to synchronize the subforms so that a given corresponding record is opened when I switch to a new subform.


    I know I can do it with a button from the previous form, but it would be preferable to use an event such as Activate.

  2. #2
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    how are you referencing your subform controls? take a look at
    http://access.mvps.org/access/forms/frm0031.htm

  3. #3
    jgm835 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    5
    Thanks, but I'm not having a problem referencing controls and I had that "frm0031.htm" information saved in my OneNote Access file.
    The problem is the form events are not firing on forms when they are a NavigationSubform of a NavigationForm. The form events on the main NavigationForm fire but not its subforms.

  4. #4
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    Sorry. That's usually the first thing that is wrong. Do you have a sample to post?

  5. #5
    jgm835 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Apr 2015
    Posts
    5
    Quote Originally Posted by vicsaccess View Post
    Sorry. That's usually the first thing that is wrong. Do you have a sample to post?
    Too voluminous to post code, but I have a NavigationForm, with the same name, with 4 subforms, named frmBills, frmCompanies, frmUnpaidBills,frmListEditor and frmPaySources. The NavigationForm has fields txtCompanyID and txtCompanyName which are updated to the current company by each subform.
    I would like the Form_Open, or Form_Activate or possibly Form_Activate events to execute code that grabs the data from txtCompanyID and synchronizes the subform to that Company in case of frmCompanies, or to a record on frmBills corresponding to that Company. I already have comboboxes to select a record in each form to do that. I am questioning why I can't get the form events to fire when the subforms are contained within the NavigationForm, but they fire fine when the subforms are opened.

    The best answer I've found so far is to use an event of NavigationButton7, that corresponds to the frmBills. I can get it's GotFocus event to fire when it is clicked and I can use it, but my question still is why Form events don't work in the contained subforms, since that seems the more logical way to go?

  6. #6
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    i did a little searching and yes you are right subforms activate event does not work. still guessing but if i'm understanding correctly i think i did something similar a little bit ago but how i accomplished it was to have the code i wanted on my main form as a gotfocus event of an invisible command and then set the subforms to setfocus on that command button if i needed the code. not sure if that helps.

  7. #7
    jgm835 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Apr 2015
    Posts
    5
    vicsacces, thanks for your comment. But regarding the code on your subform that set the focus to the invisible command on your main form, which then via its GotFocus event triggered the code you wanted to run -- my question his how did you trigger the code on the subform? If that subform code could somehow be triggered automatically it could be a work around for the subform activate (or other events not firing).

    I did get a work around. On my "frmUnpaid" subform I created a command button that opened my "frmBills" subform using the DoCmd.BrowseTo command and when I opened the frmBills NavigationSubform and set its filter. Using BrowseTo in that way, the frmBills Form_Open event did get fired. So that appears to be a case where a NavigationSubform event did work.

    Here is the code: (the "Navigation Form" was word wrapped in the paste)
    DoCmd.BrowseTo ObjectType:=acBrowseToForm, ObjectName:="frmBills", PathToSubformControl:="Navigation Form.NavigationSubform", DataMode:=acFormEdit
    With [Forms]![Navigation Form]![NavigationSubform].Form
    .Filter = "[TxID] = " & lngTrxnID
    End With

    So I guess that I've learned I'll have to synchronize between NavigationSubforms with a command button instead of clicking on the subform navigation button. Sort of partially defeats the benefit of the NavigationForm.

  8. #8
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    still seems weird. can you post a slimmed down version of the DB?

  9. #9
    jgm835 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Apr 2015
    Posts
    5
    The db is 505 megabytes, admittedly a lot of it is from utility modules I've loaded, so I think that would be difficult. Since I've been able to find only sparse mention of form events not working doing a Bing search I have to acknowledge the possibility that I may have some db degradation that has been propogated.
    It may take several days but I'll get back to you. In the meantime I will (1) create a new db and import all the current objects into it and observe any differences, 2) is create a new Navigation Form and subforms with similar structure in a new db and test out the workings of form events in those and 3) also take a look at previous implementations of Navigation Forms in previous dbs I've written.

    In the meantime I'd like to hear about whether anyone finds form events working / not working in subforms contained in a Navigation Form.

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

Similar Threads

  1. Table after events not working... WHY!?
    By McShaman in forum Access
    Replies: 1
    Last Post: 05-20-2014, 05:02 AM
  2. Replies: 3
    Last Post: 05-23-2013, 05:30 PM
  3. NavigationSubform Not Populating Records
    By altemir in forum Forms
    Replies: 3
    Last Post: 04-30-2012, 03:19 PM
  4. Replies: 9
    Last Post: 11-22-2011, 05:23 PM
  5. Replies: 0
    Last Post: 02-15-2011, 01:43 PM

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