I have a main form containing PERSON records (frm_pers). Within it there is a subform containing their TELEPHONE numbers (frm_tele). The forms are based on the tables PERS and TELE. The primary key field of PERS is named pers_id and so is the foreign key field of TELE. So the "link child fields" and "link master fields" properties of the subform are both "pers_id". This is all very simple.
In the subform frm_tele i have two arrow buttons to move records up and down. To enable/disable these buttons i wrote the following code in the "On Current" trigger:
but_up.Enabled = CurrentRecord > 1
but_dn.Enabled = CurrentRecord < Recordset.RecordCount
The idea is simple: the first record cannot be moved up and the last record cannot be moved down. It works perfect.
But now comes the trouble: if i close the main form and the subform contains no records then this code leads to the error message "No Current Record".
If i remove the 2 lines the error does not occur. What makes it really indigestible is that the "On Current" event does not fire at all, when there are no records (i put a message box to verify this)! Still the code within it leads to an error ...
Is there anybody who understands this?
In the subform frm_tele i have two arrow buttons to move records up and down. To enable/disable these buttons i wrote the following code in the "On Current" trigger:
but_up.Enabled = CurrentRecord > 1
but_dn.Enabled = CurrentRecord < Recordset.RecordCount
The idea is simple: the first record cannot be moved up and the last record cannot be moved down. It works perfect.
But now comes the trouble: if i close the main form and the subform contains no records then this code leads to the error message "No Current Record".
If i remove the 2 lines the error does not occur. What makes it really indigestible is that the "On Current" event does not fire at all, when there are no records (i put a message box to verify this)! Still the code within it leads to an error ...
Is there anybody who understands this?
Last edited: