I have a Textbox (Auto_Header0) in the header of a search form to display the name of the organisation and concatenated text. The name of the organisation is retrieved by a function. The control source for the text box is : =fMainOrg("FullName")+" Search"
Unless I (temporarily) set the focus to this control using the on load event for the form it does not display. It displays correctly when enabled on load by including the following 2 lines of code:
Me.Auto_Header0.SetFocus ' Needs focus to display
Me.Auto_Header0.Enabled = False ' Turn off as should not be editable
However this is not satisfactory: If I move to different form, the Textbox on this form no longer shows the text. Returning focus back to this form, the text box does not display any text.
To overcome this I have tried using the onActivate event, and the GotFocus event to set focus, enable and the then (dis)enable the text box to force it to display the expected text. These did not resolve the situation. onActivate only works following onLoad so is not triggered again, GotFocus had no effect. So tried OnCurrent:
The search form is used to open a form for a specific selected record - when any of these are closed a requery of this search form (to show any updates in the search list) occurs. If I use the OnCurrent Event to enable/setfocus and then disable the text box it displays the content of the text box but has the unintended consequence that :
1. The text box "flashes" as it is enabled/disabled when the user selects a record form the list of search results (to launch a form)
2. it requires two clicks instead of the expected one, when the user selects the searched for record to open the form (ie to the user it appears not to respond on the first click) - because the OnCurrent occurs as you move to a new record - and selecting a record in the search fires this event.
Is there a way around this - apart from closing the search form and reloading it - instead of a requery?
And is this normal behaviour for a text box with a control source using a function ? The same form has a call to a function for an image control that works fine, so it is strange.
BTW using Access 2010
Unless I (temporarily) set the focus to this control using the on load event for the form it does not display. It displays correctly when enabled on load by including the following 2 lines of code:
Me.Auto_Header0.SetFocus ' Needs focus to display
Me.Auto_Header0.Enabled = False ' Turn off as should not be editable
However this is not satisfactory: If I move to different form, the Textbox on this form no longer shows the text. Returning focus back to this form, the text box does not display any text.
To overcome this I have tried using the onActivate event, and the GotFocus event to set focus, enable and the then (dis)enable the text box to force it to display the expected text. These did not resolve the situation. onActivate only works following onLoad so is not triggered again, GotFocus had no effect. So tried OnCurrent:
The search form is used to open a form for a specific selected record - when any of these are closed a requery of this search form (to show any updates in the search list) occurs. If I use the OnCurrent Event to enable/setfocus and then disable the text box it displays the content of the text box but has the unintended consequence that :
1. The text box "flashes" as it is enabled/disabled when the user selects a record form the list of search results (to launch a form)
2. it requires two clicks instead of the expected one, when the user selects the searched for record to open the form (ie to the user it appears not to respond on the first click) - because the OnCurrent occurs as you move to a new record - and selecting a record in the search fires this event.
Is there a way around this - apart from closing the search form and reloading it - instead of a requery?
And is this normal behaviour for a text box with a control source using a function ? The same form has a call to a function for an image control that works fine, so it is strange.
BTW using Access 2010