By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,490 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,490 IT Pros & Developers. It's quick & easy.

IsVisible Error

P: n/a
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_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Me.Add_Sign_Button.IsVisible Then
Call Add_Sign_Button_Click
ElseIf Me.Update_Signer.IsVisible Then
Call Update_Signer_Click
End If
Me.Add_Signer.SetFocus
End If
End Sub

Any ideas?
Aug 18 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Me.Add_Sign_Button.IsVisible Then
Call Add_Sign_Button_Click
ElseIf Me.Update_Signer.IsVisible Then
Call Update_Signer_Click
End If
Me.Add_Signer.SetFocus
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_Button.Visible Then

--
Marsh
Aug 18 '08 #2

P: n/a
On Aug 18, 2:54 pm, Marshall Barton <marshbar...@wowway.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_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Me.Add_Sign_Button.IsVisible Then
Call Add_Sign_Button_Click
ElseIf Me.Update_Signer.IsVisible Then
Call Update_Signer_Click
End If
Me.Add_Signer.SetFocus
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_Button.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?
Aug 20 '08 #3

P: n/a
iwasinnihon wrote:
>On Aug 18, 2:54 pm, Marshall Barton <marshbar...@wowway.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_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Me.Add_Sign_Button.IsVisible Then
Call Add_Sign_Button_Click
ElseIf Me.Update_Signer.IsVisible Then
Call Update_Signer_Click
End If
Me.Add_Signer.SetFocus
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_Button.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
EnterKeyBehavior 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
Aug 21 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.