Results 1 to 3 of 3

Thread: Keydown (2000)

  1. #1
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Keydown (2000)

    Hi,

    I have three search field and one search button on the search form. I put the VB code in the search button, if user don't enter anyting in one of search filed and click search button, DB appears message to ask user to enter a search criteria.

    Then I put the following code on the keydown property of those three search field so after user enter a search criteria, db is going to get search result. So user don't have to click search button. However, even I enter a search criteria. Message (Please enter a search criteria" pops up instead of search result. So I don't where is wrong. Maybe the code I put on keydown or something else. I already turn on the keyview property of the search form.

    Private Sub TxtSearch_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeyReturn
    cmdSearch_Click
    End Select
    End Sub


    Please help.

    Regards.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Keydown (2000)

    I wouldn't do it like this. Set the Default property of the command button cmdSearch to Yes instead. This will cause the Enter key to act as if you clicked the Search button without using any extra code.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Keydown (2000)

    Thanks

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •