Required field fails - Focus on different form?

Robertio

Member²
2 Forms:

Form 1 has a read only grid and an OracleDataset which are linked with a datasource. On double click of the grid form 2 is shown not in modal.

Form 2 has a datasource and a few dbEditboxes. This datasource links back to the dataset on form1. On this form you can insert into the dataset, on which there are required fields.

The problem arises where the user inserts a record (Form2), and does not fill in all the required fields. They go back to the main form and select a different record on the grid, this results in the dataset trying to save the data and finding required fields do not have values. The standard error box is displayed, and focus stays on Form1 (probably because it is the main form). I can't find any way of getting the focus to switch to Form 2 on errors, short of minimising Form1 on UpdateData of the datasource on Form2.

Any ideas?
 
I can't think of any elegant solution. Perhaps you need to explicitly check the state of the other dataset and post it before the master dataset is scrolled. This way you can handle the error and bring the corresponding form to the front.

------------------
Marco Kalter
Allround Automations
 
Back
Top