use one form with mor record source

Ashabi47

New member
Local time
Yesterday, 18:55
Joined
Jun 23, 2016
Messages
1
hello dear

I use a navigation form , in each navigation tab I have a form with tow sub form
I want to use these same sub forms in each navigation tab
I want to change the record source of each sub form by clicking on the navigation tab

would you please help me ?
 
Hi Ashabi47

Considering
  • 1st form name form1
  • 2d form named frmNavigation
    1. Inside frmNavigation, a navigation object renamed myNavObj

To assign dynamically form1 to myNavObj on each page click event, proceed as follows:

Code:
 DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
    ObjectName:="form1", _
    PathToSubformControl:="frmNavigation.myNavObj", _
    WhereCondition:="", _
    Page:="", _
    DataMode:=acFormEdit

To assign dynamically a new recordSource, proceed as follows

Code:
   Forms("frmNavigation").Controls("myNavObj").Form.RecordSource = "YourQuery"

You can also use filter property

Code:
   Forms("frmNavigation").Controls("myNavObj").Form.Filter = "EvaluationID = 2"
    Forms("frmNavigation").Controls("myNavObj").Form.FilterOn = True
 
just make a form for each table/query you want to include in the navigation form.
click on the tab and set its Navigation Target Name property to the name of the form you want to show in this tab.
do this with the rest of the tab.
 

Users who are viewing this thread

Back
Top Bottom