Results 1 to 4 of 4
  1. #1
    GeorgeJ is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    67

    Requery causes unwanted changes in fields' baclground properties

    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.

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by GeorgeJ View Post

    ...In the detail section of the form are two text boxes (not enabled but visible)...

    ...Access insists on changing the background color of the two fields in the details section to grey... ...

    ...I have tried playing around with the Format properties of the two fields but to no avail...
    To be honest, I'm having a problem following your explanation, but the first line, above, answers the questions raised by the latter two lines! The greyed background is simply Access telling you that those two Controls have their Enabled Property set to No...as you stated!

    If you'd prefer the background to be normal, instead of greyed out, set Enabled to No and Locked to Yes.

    Linq ;0)>

  3. #3
    GeorgeJ is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    67
    Linq,

    That works perfectly. Thanks. I don't think I ever would have guessed that.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Linq ;0)>

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Can't Choose Field Properties on Query Fields
    By tylerpickering in forum Queries
    Replies: 5
    Last Post: 04-02-2014, 01:56 PM
  2. Removing Unwanted Spaces From Table Fields, Access 2007
    By rd.prasanna in forum Programming
    Replies: 3
    Last Post: 11-11-2013, 05:23 PM
  3. Replies: 4
    Last Post: 07-17-2013, 01:11 PM
  4. Unwanted grey combo box fields on form
    By wouterv81 in forum Forms
    Replies: 1
    Last Post: 04-25-2012, 02:42 AM
  5. One table multiple fields identical properties.
    By swampdonkey in forum Queries
    Replies: 2
    Last Post: 09-29-2006, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums