Results 1 to 4 of 4

Thread: Search Option

  1. #1
    Addicted Member
    Join Date
    Dec 11
    Posts
    243

    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
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    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 12
    Location
    West Virginia
    Posts
    4,953

    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
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    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
  •