Results 1 to 5 of 5
  1. #1
    mcfischer91 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2014
    Posts
    6

    Event Timing with Hiding/Unhiding Objects


    So, I have certain things that I want to hide/unhide based on another field. Here's what my code looks like:

    Code:
    Private Sub Form_Current()
    
    
        If Me.System = "Thomas" Then
            Me.Market.Visible = True
            Me.Region.Visible = True
        Else
            Me.Market.Visible = False
            Me.Region.Visible = False
        End If
    End Sub
    .



    The objects hide/unhide like they're supposed to, but it doesn't take effect until I save, refresh, or go to another record. Is there a way to make it so the objects hide/unhide immediately after the other field is changed?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Have same code in control's AfterUpdate event.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mcfischer91 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2014
    Posts
    6
    I've tried it like this:
    Code:
    Private Sub Form_Current()
    
    
    
    
        If Me.System = "Thomas" Then
            Me.Market.Visible = True
            Me.Region.Visible = True
        Else
            Me.Market.Visible = False
            Me.Region.Visible = False
        End If
    End Sub
    
    
    Private Sub Form_AfterUpdate()
    
    
    
    
        If Me.System = "Thomas" Then
            Me.Market.Visible = True
            Me.Region.Visible = True
        Else
            Me.Market.Visible = False
            Me.Region.Visible = False
        End If
    End Sub
    and it doesn't seem like it changes anything.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Not the Form event - the control event. What is the control that is bound to the 'other field' - textbox, combobox?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    mcfischer91 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2014
    Posts
    6
    My god it worked! Thank you so much!

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

Similar Threads

  1. Timing issue
    By aytee111 in forum Modules
    Replies: 2
    Last Post: 05-13-2014, 03:47 PM
  2. count (*) timing out
    By aat in forum Queries
    Replies: 2
    Last Post: 12-14-2013, 06:04 AM
  3. select case or else if for unhiding
    By nichmeg in forum Programming
    Replies: 3
    Last Post: 10-30-2011, 09:30 AM
  4. Command Buttons - Hiding/Unhiding
    By Hello World in forum Forms
    Replies: 4
    Last Post: 10-10-2011, 07:51 AM
  5. timing how long users are on each form
    By salej60 in forum Access
    Replies: 3
    Last Post: 06-07-2011, 08:20 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