Using a Single Navigator for Multiple Datasets
Go Up to Navigating and Manipulating Records
As with other data-aware controls, a navigator's DataSource property specifies the data source that links the control to a dataset. By changing a navigator's DataSource property at run time, a single navigator can provide record navigation and manipulation for multiple datasets.
Suppose a form contains two edit controls linked to the CustomersTable and OrdersTable datasets through the CustomersSource and OrdersSource data sources respectively. When a user enters the edit control connected to CustomersSource, the navigator should also use CustomersSource, and when the user enters the edit control connected to OrdersSource, the navigator should switch to OrdersSource as well. You can code an Vcl.Controls.TWinControl.OnEnter event handler for one of the edit controls, and then share that event with the other edit control. For example:
procedure TForm1.CustomerCompanyEnter(Sender :TObject); begin if Sender = CustomerCompany then DBNavigatorAll.DataSource := CustomerCompany.DataSource else DBNavigatorAll.DataSource := OrderNum.DataSource; end;