Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    66

    Exclamation Unanswered: Finding the NEXT record...

    Hi everyone,

    I am using a combo box to find a record on a sheet. The problem is this...the record I'm trying to find is a student name. Since there are siblings, there are multiple people with the same last name. I thought that if I found the first name and them hit enter again in the combo box it would search for the next record with that last name, but it's not working. Instead, it finds the first record with the last name of "SMITH", but does not find the other three siblings.

    I have hunted and hunted, but I can't find a solution for this. Here's what I tried last, (again, found some hints online) but it doesn't work.

    Private Sub Combo56_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object
    Dim Message
    Set rs = Me.Recordset.Clone
    rs.FindNext "[Student_Last] = '" & Me![Combo56] & "'"
    If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark


    End Sub

    Would greatly appreciate the help!!

    Thanks!

    Susan

  2. #2
    Join Date
    Apr 2004
    Posts
    66
    Tried this too...I think I'm close, but I just can't figure it out...

    I added a control next to the combo box to find the next record with this code:

    Private Sub FindNextFamily_Click()
    On Error GoTo Err_FindNextFamily_Click


    ' Find the record that matches the control.
    Dim rs As Object
    Dim Message
    Set rs = Me.Recordset.Clone


    Combo56.RowSource = "SELECT FamilyStudentUpdateQry.Student_Last FROM FamilyStudentUpdateQry WHERE student_last= '" & Me![Combo56] & "'"
    rs.FindNext "[Student_Last] = '" & Me![Combo56] & "'"
    If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark


    Exit_FindNextFamily_Click:
    Exit Sub


    Err_FindNextFamily_Click:
    MsgBox Err.Description
    Resume Exit_FindNextFamily_Click

    End Sub

  3. #3
    Join Date
    Apr 2004
    Posts
    66
    Okay, I have one more thought on this. I think the issue is that the combo box may be searching for another record with the same FamilyID, rather than the same last name. Is that possibly the problem??

Posting Permissions

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