Hello,
I am running into a peculiar problem that I have spent considerable time trying to remedy without success so I thought I’d ask if someone on this forum can help me.
I have a tabular form which uses as its record source an SQL string (me.recordsource = ThisSql$). There is a subprogram MakeMySQL in the codefile of the form which creates the appropriate ThisSQL$ string based on a global string DeckSearchString$. In the detail section of the form are two text boxes (not enabled but visible) which show data from the SQL string. So far so good. In the header section I have a text box named SearchText. When the user puts something into this text box, the AfterUpdate routine associated with the textbox analyzes what he/she has put there and changes DeckSearchString$ and then does something like this…
DeckSearchString$ = me.SearchText
MakeMySQL
Me.recordsource = ThisSQL$
Me.requery
Me.repaint
The search works the way I expect, but there’s one nagging problem I haven’t been able to solve. The OnLoad property of the form also runs the MakeMySQL and then does a me.requery – me.repaint. This works fine. Upon entering the form and having it do the initial requery everything looks as it should. But whenever I change the text in SearchText and thus bring about another requery, Access insists on changing the background color of the two fields in the details section to grey, regardless of what the color was before. I have tried playing around with the Format properties of the two fields but to no avail. I can get it to look as I want it after the first me.requery (the one in the form’s OnLoad routine) but all subsequent requeries turn the background of those two fields grey.
Any suggestions?
Thanks in advance.