Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The screenshot shows a text box labeld with "Find". The name of the text box is "txtFind".
    The following subprocedure is assgined to the On Exit event of the text box.
    Private Sub txtFind_Exit(Cancel As Integer)
    Me.Filter = "[BookTitle] like '*" & [txtFind] & "*'"
    Me.OrderBy = "BookTitle"
    Me.FilterOn = True
    End Sub

    Yes, after entering, say, "Introduction", indeed Access succeeds to display only records with "Introduction" in the BookTitle field. Then all the nighmares start to show up. Pressing all other buttons shown in the screenshot has not effect. Especially for the "All" button, it is assigned the following subprocedures:
    Private Sub CmdAll_Click()
    Me.OrderBy = "BookTitle"
    Me.OrderByOn = True
    Me.FilterOn = False
    End Sub

    But why?

    In addition, whenever scrolling several pages down and clicking a record, the form always scroll back to the first record. It appear a Requery is executed.

    But why?

    Please help. Thanks.

    Armstrong
    Attached Images Attached Images

  2. #2
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    After assigning the same subprocedure to the After Update event of the [txtFind]. All problems are gone. But why?
    Thanks.
    Armstrong

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    We have too little information to know why, but it's probably because the On Exit procedure occurs each time the focus leaves the text box, whether the contents have changed or not, so filtering occurs too often.

Posting Permissions

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