Results 1 to 6 of 6
  1. #1
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    125

    Trying something with the OnDeactivate event

    I have a main background, home-type form, that I would like to stay up in the background while being able to open up other pop up forms.



    That all works fine, I was just trying to find a way to maybe change the background colors for the home form to maybe a more gray scale when it loses focus.

    I thought I might try this with the main form's OnDeactivate Event (and then have them change back on the Activate Event) but it doesn't seem to be working. I was wondering if there was a better option for this (or if I'm not doing something correct with the Deactivate)

    Example code:
    Code:
    Private Sub Form_Deactivate()
        Forms!frmNewHome.Detail.BackColor = 14277081
        Forms!frmNewHome.FormHeader.BackColor = 12566463
        Forms!frmNewHome.lblCRDB.ForeColor = 12566463
    End Sub

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    I think you would want the Lost Focus event instead. And the Got Focus event to change it back to normal.

  3. #3
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    125
    Was about to say "Duh...I'm dumb" but then it didn't work. Any other ideas?

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Have you tried it like this:
    Code:
    Private Sub Form_LostFocus()
        Me.Detail.BackColor = 14277081
        Me..FormHeader.BackColor = 12566463
        Me.lblCRDB.ForeColor = 12566463
    
    End Sub

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    And then the other question, if it doesn't - is the form you are wanting this done to using a subform at all?

  6. #6
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    125
    You're right that the first one should work, but I'd think if it worked my code work would work since they're the same in this instance (mine is just for more generic use).

    You're second question is right on the money though, I do in fact have a subform on that main form. Aaaand I think I see where you're going with this, it may be the subform that is actually losing the focus. Let me try it out....

    ....and it seems that didn't work either. Well I'll play around with some variations of that. If you've got any other suggestions, please feel free to post back.

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

Similar Threads

  1. Event Log strategy
    By kman42 in forum Database Design
    Replies: 1
    Last Post: 04-16-2011, 07:11 AM
  2. NotInList event
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 04-13-2011, 09:10 AM
  3. Help on an event...
    By allykid in forum Forms
    Replies: 4
    Last Post: 03-15-2011, 11:25 AM
  4. Event question
    By nkenney in forum Forms
    Replies: 1
    Last Post: 07-01-2009, 11:34 PM
  5. Replies: 21
    Last Post: 06-03-2009, 05:54 PM

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