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?
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?
Comment