Results 1 to 4 of 4

Thread: Search Option

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Search Option

    Hi

    I want when user Press Ctrl+F or F5 button inputbox should open and user enters something for search . Search can be a part of string

    Thanks

  2. #2
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: Search Option

    for F5 (from Form1)

    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Dim BoxResult As String
    
    If KeyCode = vbKeyF5 Then
      BoxResult = InputBox("Search For", "Search Input Box")
    End If
    
    Debug.Print "Searching for " & Chr(34) & BoxResult & Chr(34)
    End Sub
    Last edited by Max187Boucher; Sep 9th, 2012 at 12:50 AM.

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Search Option

    Not sure why you would set key preview in the keydown event. That really should be in the form load event or selected in the properties window. In the key down event if there is a control on the form that gets focus it will never be executed and if not then it is not needed plus would execute with every keystroke where it only needs to execute once.

    I would suggest removing that from the event.

  4. #4
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: Search Option

    Yes boss

Posting Permissions

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



Click Here to Expand Forum to Full Width