- Local time
- Tomorrow, 08:13
- Joined
- Jan 20, 2009
- Messages
- 12,832
A form has a subform control whose Source Object is a query. This query returns records from a very large table and has totals on some fields. As such it takes quite a while to fully load.
After opening the main form I can move the focus to the subform control as part of a set of VB procedures.
However opening the form programatically and immediately running the same procedures results in an error while attempting to move the focus to the subform control. If the form is already open, the same command is completed without complaint.
I expect this is matter of timing with the SetFocus command executed immediately on the form completing its load but before the subform has a chance to finish.
Is there a way to check the subform is fully loaded before proceeding?
Would using a form as the subform Source Object be likely to make any difference?
Remembering the other limitations I have encountered with using a query or table rather than a form as a Source Object in subform controls, perhaps I have another reason not to use them.
However I am reluctant to make the change without good reason since the present technique works fine otherwise and it would achieve very little if it didn't fix this focus problem.
After opening the main form I can move the focus to the subform control as part of a set of VB procedures.
However opening the form programatically and immediately running the same procedures results in an error while attempting to move the focus to the subform control. If the form is already open, the same command is completed without complaint.
I expect this is matter of timing with the SetFocus command executed immediately on the form completing its load but before the subform has a chance to finish.
Is there a way to check the subform is fully loaded before proceeding?
Would using a form as the subform Source Object be likely to make any difference?
Remembering the other limitations I have encountered with using a query or table rather than a form as a Source Object in subform controls, perhaps I have another reason not to use them.
However I am reluctant to make the change without good reason since the present technique works fine otherwise and it would achieve very little if it didn't fix this focus problem.