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

on enter event - nothing is happening

P: 27
I have a search form. and many unbound control. My main search text box "txtAccount" is acting weird or I am not doing it right.

I want user to input a value and hit the enter key. I put something on the "on Enter" event but the code kicks in as soon as I load the form.

After by passing the first error I enter something in my search box and hit the enter key on my keyboard and nothing happens. I even try to put msgbox "test" on the enter event and it does not do anything.

Please advise how can i take care of this issue. i even took out the tab stop on that text box.

Dec 13 '07 #1
Share this Question
Share on Google+
2 Replies

P: 27
I used this and now it's working.

Private Sub txtEnterLoanNum_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
End If
End Sub
Dec 13 '07 #2

Expert 2.5K+
P: 3,532
The OnEnter event fires when a text field is entered, not when the <Enter> key is pressed.

Your method should work, or Access has a property of command buttons that also would work. You simply place a button on your form to execute the code, then goto Properties - Other and set Default to Yes. Then, unless another command button has the focus (which it wouldn't if you're still in a textbox) anytime you press <Enter> the button will fire. This would give the user two ways to trigger the code (some like/expect to see a button to click on) or if you only want them to hit <Enter> goto Properties - Format and set Transparent Property to Yes.

Linq ;0)>
Dec 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.