Results 1 to 4 of 4
  1. #1
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133

    First click, second click. VB

    So I have created a form that is pinned like a dock centered on top of the screen with icons that open different web based software. I have played with it quite a bit and I feel maybe I've just been staring for too long.

    The first click works fine, secondary form loads no issues, however I want the form.visible=false after the second click(remain running) and then with the third click it comes back up as it was when it was sent away. This is what I'm playing with now and when you click the second time it just pulls the window to the front like it's only running the first part. Still learning so take it easy on me :P



    Code:
    Private Sub Auto_Logo2_Click()
    DoCmd.OpenForm FormName:="FRMxOutlook"
    If CurrentProject.AllForms("FRMxOutlook").IsLoaded Then
    Forms!FRMxOutlook.Visible = True
    
    
    ElseIf Forms!FRMxOutlook.Visible = True Then
    Forms!FRMxOutlook.Visible = False
    
    
    End If
    End Sub
    and I played with

    Code:
    Private Sub Auto_Logo2_Click()
    DoCmd.OpenForm FormName:="FRMxOutlook"
    If CurrentProject.AllForms("FRMxOutlook").IsLoaded And Forms!FRMxOutlook.Visible = False Then
    Forms!FRMxOutlook.Visible = True
    
    
    ElseIf CurrentProject.AllForms("FRMxOutlook").IsLoaded And Forms!FRMxOutlook.Visible = True Then
    Forms!FRMxOutlook.Visible = False
    
    
    End If
    End Sub

  2. #2
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133
    Got it :P

    Code:
    Private Sub Auto_Logo2_Click()
    If Not CurrentProject.AllForms("FRMxOutlook").IsLoaded Then
    DoCmd.OpenForm FormName:="FRMxOutlook"
    
    
    ElseIf CurrentProject.AllForms("FRMxOutlook").IsLoaded And Forms!FRMxOutlook.Visible = True Then
    Forms!FRMxOutlook.Visible = False
    
    
    
    
    End If
    End Sub

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I try not to use negative logic in IF() statements, so I rearranged the statements.

    What about:
    Code:
    Private Sub Auto_Logo2_Click()
        If CurrentProject.AllForms("FRMxOutlook").IsLoaded Then
            Forms!FRMxOutlook.Visible = Not Forms!FRMxOutlook.Visible
        Else
            DoCmd.OpenForm FormName:="FRMxOutlook"
        End If
    End Sub

  4. #4
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133
    I realized the issues as soon as I started to play with it, your solution worked wonderfully, and the advice to not use negative logic will be forever helpful. Thank you!

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

Similar Threads

  1. Report out with one click
    By jj1 in forum Access
    Replies: 6
    Last Post: 09-29-2014, 01:38 PM
  2. To click - or not to click...
    By David618 in forum Programming
    Replies: 9
    Last Post: 05-09-2013, 01:38 PM
  3. SaveIt ( ) on Click
    By windwardmi in forum Access
    Replies: 4
    Last Post: 09-07-2011, 03:51 PM
  4. Can't Right Click Categories
    By netchie in forum Access
    Replies: 2
    Last Post: 10-26-2010, 10:48 AM
  5. Form on click
    By rexb in forum Forms
    Replies: 0
    Last Post: 11-16-2009, 08:49 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