Synchronizing tables linked to the same database table

From InterBase

Go Up to Working with Tables

If more than one table component is linked to the same database table through their Database and TableName properties and the tables do not share a data source component, then each table has its own view on the data and its own current record. As users access records through each table component, the components’ current records will differ.

You can force the current record for each of these table components to be the same with the GotoCurrent method. GotoCurrent sets its own table’s current record to the current record of another table component. For example, the following code sets the current record of CustomerTableOne to be the same as the current record of CustomerTableTwo:

If your application needs to synchronize table components in this manner, put the components in a data module and include the header for the data module in each unit that accesses the tables.

If you must synchronize table components on separate forms, you must include one form’s header file in the source unit of the other form, and you must qualify at least one of the table names with its form name.

For example:


Advance To: