Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    Unanswered: form moves to next record even when filter applied

    the form properties are:
    viewsAllowed:Form
    Defualt view: single form
    navigation buttons:no

    Private Sub cboAgentsName_AfterUpdate()
    On Error GoTo ErrorHandler

    Dim strSearch As String

    strSearch = "[AgentId] = " & Me![cboAgentsName]

    'Find the record that matches the control.
    Me.RecordsetClone.FindFirst strSearch
    Me.Bookmark = Me.RecordsetClone.Bookmark

    ErrorHandlerExit:
    Exit Sub

    ErrorHandler:
    msgbox "Error No: " & err.Number & "; Description: " & err.Description
    Resume ErrorHandlerExit

    End Sub

  2. #2
    Join Date
    Mar 2007
    Posts
    277
    Try:
    Code:
    If Not Me.RecordsetClone.NoMatch Then
        Me.Bookmark = Me.RecordsetClone.Bookmark
    End If
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  3. #3
    Join Date
    Jan 2008
    Location
    Denver, CO
    Posts
    54
    you could also try setting the cycle property... something like:

    Code:
    Me.Cycle = 1 ' only cycle Current Record
                       ' rather than 0 for all 
                       ' or 2 for current page

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ^ I love that setting
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    And perhaps check your tab order. If it moves to the next record after applying the filter, it could mean the field you're filtering on is the last field in the tab cycle (or change the cycle property as mentioned above). You can also do a me.MyFieldName.Setfocus.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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