IsVisible Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • iwasinnihon

    #1

    IsVisible Error

    I have created a form that has a list box that displays information
    queried from a table. I then have a textbox under the form and three
    buttons under that(Add, Update, Delete). When the form is loaded, the
    Update and Delete buttons are not visible. If you type an entry into
    the textbox and click add it is added to the table and the list
    refreshes. If you double click on an entry in the list, the entry
    appears in the textbox, the Add button disappears and the Update and
    Delete buttons become visible. All of that works find and all of the
    buttons work great. What I want to be able to do is utilize pressing
    the Enter key on the keyboard.

    If the Add button is visible, I want the enter key to activate the Add
    button. If the Update button is visible, I want the enter key to
    activate the Update button. However, all I get is a
    Run-Rime error '2455':
    You entered an expression that has an invalid reference to the
    property IsVisible.

    Here is my code:
    Private Sub Add_Signer_KeyP ress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    If Me.Add_Sign_But ton.IsVisible Then
    Call Add_Sign_Button _Click
    ElseIf Me.Update_Signe r.IsVisible Then
    Call Update_Signer_C lick
    End If
    Me.Add_Signer.S etFocus
    End If
    End Sub

    Any ideas?
  • Marshall Barton

    #2
    Re: IsVisible Error

    iwasinnihon wrote:
    >I have created a form that has a list box that displays information
    >queried from a table. I then have a textbox under the form and three
    >buttons under that(Add, Update, Delete). When the form is loaded, the
    >Update and Delete buttons are not visible. If you type an entry into
    >the textbox and click add it is added to the table and the list
    >refreshes. If you double click on an entry in the list, the entry
    >appears in the textbox, the Add button disappears and the Update and
    >Delete buttons become visible. All of that works find and all of the
    >buttons work great. What I want to be able to do is utilize pressing
    >the Enter key on the keyboard.
    >
    >If the Add button is visible, I want the enter key to activate the Add
    >button. If the Update button is visible, I want the enter key to
    >activate the Update button. However, all I get is a
    >Run-Rime error '2455':
    >You entered an expression that has an invalid reference to the
    >property IsVisible.
    >
    >Here is my code:
    >Private Sub Add_Signer_KeyP ress(KeyAscii As Integer)
    >If KeyAscii = 13 Then
    If Me.Add_Sign_But ton.IsVisible Then
    Call Add_Sign_Button _Click
    ElseIf Me.Update_Signe r.IsVisible Then
    Call Update_Signer_C lick
    End If
    Me.Add_Signer.S etFocus
    >End If
    >End Sub

    IsVisible is for use with the HideDuplicates property in
    reports.

    You want to use the Visible property:
    If Me.Add_Sign_But ton.Visible Then

    --
    Marsh

    Comment

    • iwasinnihon

      #3
      Re: IsVisible Error

      On Aug 18, 2:54 pm, Marshall Barton <marshbar...@wo wway.comwrote:
      iwasinnihon wrote:
      I have created a form that has a list box that displays information
      queried from a table. I then have a textbox under the form and three
      buttons under that(Add, Update, Delete). When the form is loaded, the
      Update and Delete buttons are not visible. If you type an entry into
      the textbox and click add it is added to the table and the list
      refreshes. If you double click on an entry in the list, the entry
      appears in the textbox, the Add button disappears and the Update and
      Delete buttons become visible. All of that works find and all of the
      buttons work great. What I want to be able to do is utilize pressing
      the Enter key on the keyboard.
      >
      If the Add button is visible, I want the enter key to activate the Add
      button. If the Update button is visible, I want the enter key to
      activate the Update button. However, all I get is a
      Run-Rime error '2455':
      You entered an expression that has an invalid reference to the
      property IsVisible.
      >
      Here is my code:
      Private Sub Add_Signer_KeyP ress(KeyAscii As Integer)
      If KeyAscii = 13 Then
      If Me.Add_Sign_But ton.IsVisible Then
      Call Add_Sign_Button _Click
      ElseIf Me.Update_Signe r.IsVisible Then
      Call Update_Signer_C lick
      End If
      Me.Add_Signer.S etFocus
      End If
      End Sub
      >
      IsVisible is for use with the HideDuplicates property in
      reports.
      >
      You want to use the Visible property:
      If Me.Add_Sign_But ton.Visible Then
      >
      --
      Marsh
      Thank you. I no longer get the error message. However, there is
      something weird going on. Now if I type something into the textbox
      and hit [Enter] the box clears and nothing is added to the table.
      However, once you leave the box, what you had typed reappears. If you
      then go back to that textbox and hit [Enter] the entry is added to the
      table. Any ideas?

      Comment

      • Marshall Barton

        #4
        Re: IsVisible Error

        iwasinnihon wrote:
        >On Aug 18, 2:54 pm, Marshall Barton <marshbar...@wo wway.comwrote:
        >iwasinnihon wrote:
        >I have created a form that has a list box that displays information
        >queried from a table. I then have a textbox under the form and three
        >buttons under that(Add, Update, Delete). When the form is loaded, the
        >Update and Delete buttons are not visible. If you type an entry into
        >the textbox and click add it is added to the table and the list
        >refreshes. If you double click on an entry in the list, the entry
        >appears in the textbox, the Add button disappears and the Update and
        >Delete buttons become visible. All of that works find and all of the
        >buttons work great. What I want to be able to do is utilize pressing
        >the Enter key on the keyboard.
        >>
        >If the Add button is visible, I want the enter key to activate the Add
        >button. If the Update button is visible, I want the enter key to
        >activate the Update button. However, all I get is a
        >Run-Rime error '2455':
        >You entered an expression that has an invalid reference to the
        >property IsVisible.
        >>
        >Here is my code:
        >Private Sub Add_Signer_KeyP ress(KeyAscii As Integer)
        >If KeyAscii = 13 Then
        If Me.Add_Sign_But ton.IsVisible Then
        Call Add_Sign_Button _Click
        ElseIf Me.Update_Signe r.IsVisible Then
        Call Update_Signer_C lick
        End If
        Me.Add_Signer.S etFocus
        >End If
        >End Sub
        >>
        >IsVisible is for use with the HideDuplicates property in
        >reports.
        >>
        >You want to use the Visible property:
        > If Me.Add_Sign_But ton.Visible Then
        >>
        >
        >Thank you. I no longer get the error message. However, there is
        >something weird going on. Now if I type something into the textbox
        >and hit [Enter] the box clears and nothing is added to the table.
        >However, once you leave the box, what you had typed reappears. If you
        >then go back to that textbox and hit [Enter] the entry is added to the
        >table.

        I thought you said all that was working fine ;-)

        I may not be a good person to unravel this new issue, It's
        usually a good idea to start a new thread when you have a
        new question.

        My only thoughts are that it sounds like the text box's
        EnterKeyBehavio r is set to accept the enter key into the
        text in the text box.

        OTOH, I do not understand why you are using the KeyPress
        event instead of the AfterUpdate event. Maybe the problem
        has something to do with the focus moving around on every
        keystroke??

        --
        Marsh

        Comment

        Working...