- Local time
- Tomorrow, 07:39
- Joined
- Jan 20, 2009
- Messages
- 12,895
When a filter is applied to a form resulting in no records displaying, the Text property of an unbound control in the header becomes unavailable.
The error is the usual 2185 encountered if the Text property is referred to when the control does not have focus. "You can't reference a property or method of a control unless the control has focus."
However the textbox does have focus. I can see no logical reason for the error except that it is a bug caused by an incorrect assumption that a zero RecordCount on the form automatically means no control can take the focus.
If the AllowAdditions property is True for the form, the New Record prevents the error. For convenience I have included a button to toggle this property in the demo.
A workaround is to put the searched form into a subformcontrol with the search textbox in the main form. However I would be interested in any workarounds that don't require this extra construction.
The error is the usual 2185 encountered if the Text property is referred to when the control does not have focus. "You can't reference a property or method of a control unless the control has focus."
However the textbox does have focus. I can see no logical reason for the error except that it is a bug caused by an incorrect assumption that a zero RecordCount on the form automatically means no control can take the focus.
If the AllowAdditions property is True for the form, the New Record prevents the error. For convenience I have included a button to toggle this property in the demo.
A workaround is to put the searched form into a subformcontrol with the search textbox in the main form. However I would be interested in any workarounds that don't require this extra construction.