How do I bypass "Cannot find the referenced form frm_FromName" without opening the form hidden? (1 Viewer)

5hadow

Member
Local time
Today, 14:19
Joined
Apr 26, 2021
Messages
89
Just like my tittle says, on my main form I have a navigation control with a button to form in subject.

So, here's the structure of the issue:

frm_Main contains:
  • Nav Control with button to frm_Members

frm_Members contains:
  • Search box txt_Search with code:
    • Code:
      Private Sub txt_Search_Change()
         Me.txt_TempSearchData = Me.txt_Search.Text
         Me.NavigationSubform.Requery
      End Sub
  • Temporary text field txt_TempSearchData
  • Another Nav Control with a subform frm_UserList (frm_UserList is based on qry_UserQuals)

qry_UserQuals contains custom field SearchTerms:
  • Main field is SearchTerms: [LastName] & [FirstName]
  • Criteria is Like "*" & [Forms]![frm_Main]![NavigationSubform]![txt_TempSearchData] & "*"

This setup allows me to type in the txt_Search and it will search and filter subform frm_UserList as I type.
Issue is when navigating from main form to frm_Members I get an error where it cannot find frm_Members.
This is because the form is not opened.... yet. Once I click on "End" on prompt, everything loads and works.

What is the most elegant solution to this without having to open the subform frm_Members hidden? Best way to handle this?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:19
Joined
Feb 28, 2001
Messages
27,188
Well..... if the form in question is not open yet, then you cannot access it because it only exists in potential. There is an order to the way things are done in Access, and unfortunately the contents of the form can only be "touched" AFTER the form is open. So... in the precise way you asked the question, the answer is "You can't."
 

561414

Active member
Local time
Today, 13:19
Joined
May 28, 2021
Messages
280
Navigation controls open one form at a time. The setup you describe should work as expected if the first/default form in your navigation control frm_Main is frm_Members and if the first/default form in frm_Members is frm_UserList. If they are not, then either make them first/default or make sure the forms are open at the time you are attempting to access it, which is in the txt_Search_Change() event.

By the way, the title of this thread refers to frm_FromName. Where is that? If you want to bypass a hidden form, then don't hide it, use a tab control.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:19
Joined
May 7, 2009
Messages
19,245
better to upload your forms, so we can troubleshoot.
normally for navigation form, you use BrowseTo to filter the form.
 

Users who are viewing this thread

Top Bottom