Avatar of skull52
skull52
Flag for United States of America asked on

Referencing a Control on a sub Form on a Navigation Form

I have a form frmVenAttendence that I added into a navigation form frmNavigation. the frmVenAttendence has a text box control  named businessname which is used on a report to display the contents of that control on the report. The report control  Source is =[Forms]![frm_VenAttendance]![businessname] which works fine outside the the navigation form. I know that when you put the form into a navigation form it actually becomes a subform of the navigation form and I need to reference both, but I am having a hard time getting the syntax correct. I have tried
 =[Forms]![frmNavigation]![frm_VenAttendance].[form].[businessname]
=[Forms]![frm_VenAttendance]![frmNavigation].[form].[businessname]
neither work and am asked to enter the parameter value for that control.
Microsoft AccessVisual Basic ClassicVBA

Avatar of undefined
Last Comment
skull52

8/22/2022 - Mon
skull52

ASKER
Help!!
IrogSinta

The syntax you listed first is the correct one.
=[Forms]![frmNavigation]![frm_VenAttendance].[form].[businessname]
However, this will only work if frm_VenAttendance is actually visible.  If your navigation form is displaying another tab, you cannot reference [business name].

Ron
skull52

ASKER
it is visible in the navigation form
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
skull52

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
skull52

ASKER
however i now have other issues with this, I am beginning to think this was a bad idea.

I have some vba code that does filtering but now it errors as it doesn't know about the navigation form. This is my first foray into Navigation forms and may be my last. Really need some help with this.
the original code

'Filter frmCustomers based on search criteria
      Forms!frm_VenAttendance.Filter = GCriteria
      Forms!frm_VenAttendance.FilterOn = True
      If Me.optWild.Value = 1 Then
        Forms!frm_VenAttendance.Caption = "Vendors (" & Me.cboSearchField & " contains '*" & Me.txtSearchString & "*')"
       Else
        Forms!frm_VenAttendance.Caption = "Vendors (" & Me.cboSearchField & " equals '" & Me.txtSearchString & "')"
      End If

Open in new window

What I tried to modify for navigation form
        'Filter frmCustomers based on search criteria
      [Forms]![NavigationSubform].[Form].frm_VenAttendance.Filter = GCriteria
      [Forms]![NavigationSubform].[Form].frm_VenAttendance.FilterOn = True
      If Me.optWild.Value = 1 Then
        [Forms]![NavigationSubform].[Form].frm_VenAttendance.Caption = "Vendors (" & Me.cboSearchField & " contains '*" & Me.txtSearchString & "*')"
       Else
        [Forms]![NavigationSubform].[Form].frm_VenAttendance.Caption = "Vendors (" & Me.cboSearchField & " equals '" & Me.txtSearchString & "')"
      End If

Open in new window

skull52

ASKER
Anyone?
IrogSinta

Can you upload your database without any private data on it?

Ron
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
skull52

ASKER
Do to the time constraint I have decided to go a different way and not use the Navigation form, thanks anyway.
skull52

ASKER
Because that is what worked no other acceptable solution was provided.