on enter event - nothing is happening

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ozarka
    New Member
    • Oct 2007
    • 27

    on enter event - nothing is happening

    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.

    Thanks
  • ozarka
    New Member
    • Oct 2007
    • 27

    #2
    I used this and now it's working.

    Private Sub txtEnterLoanNum _KeyDown(KeyCod e As Integer, Shift As Integer)
    If KeyCode = 13 Then
    f_runitnow
    End If
    End Sub

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      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)>

      Comment

      Working...