Hi all,
I'm working on a "find" button for a form with several tabbed subforms. What I'm trying to do is pick up the name of previous control and form so that when my little "Find" form opens, the previous control defaults as the field to search from the combo box cboField (all the other controls on the form are options in the combo box). The previous control sets the value of cboField, while the list of controls supply the row source. A textbox lists the name of the form being searched (Main for mainform, each subform is listed as a "category"
. For simplicity's sake, the find button is on the main form.
I'm using
Screen.PreviousControl.Name (to get the control)
Screen.ActiveForm.Name (to get the form)
This works perfectly on the Main form, but is another story with the subforms. The Previous control turns up as the name of the subform, and the Active form as the Main form.
Is there a better way??
Thanks a ton,
CJ
I'm working on a "find" button for a form with several tabbed subforms. What I'm trying to do is pick up the name of previous control and form so that when my little "Find" form opens, the previous control defaults as the field to search from the combo box cboField (all the other controls on the form are options in the combo box). The previous control sets the value of cboField, while the list of controls supply the row source. A textbox lists the name of the form being searched (Main for mainform, each subform is listed as a "category"
I'm using
Screen.PreviousControl.Name (to get the control)
Screen.ActiveForm.Name (to get the form)
This works perfectly on the Main form, but is another story with the subforms. The Previous control turns up as the name of the subform, and the Active form as the Main form.
Is there a better way??
Thanks a ton,
CJ