Link to home
Create AccountLog in
Avatar of Fred Webb
Fred WebbFlag 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.
Avatar of Fred Webb
Fred Webb
Flag of United States of America image

ASKER

Help!!
Avatar of 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
it is visible in the navigation form
ASKER CERTIFIED SOLUTION
Avatar of Fred Webb
Fred Webb
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
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

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

Ron
Do to the time constraint I have decided to go a different way and not use the Navigation form, thanks anyway.
Because that is what worked no other acceptable solution was provided.