Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    35

    Unanswered: FindFirst.NoMatch and search again

    I'd be really grateful if someone could tell me what I'm doing wrong. I'm searching for a name (this works if the name exists). If the name is not found, I want to search on another field. This seems to work but the form always shows the first record, as if the bookmark is not working. I have tried putting the bookmark line in various places but either I get error messages or it doesn't work. (This code is within Form_Activate)

    Thanks

    Dim chPos As Integer
    searchTxt = "[Full Name] = " & Chr(39) & whichParent1 & Chr(39)

    rst.FindFirst searchTxt
    If rst.NoMatch Then
    rst.MoveFirst
    chPos = InStr(whichParent1, ", ") + 1
    whichParent1 = Right$(whichParent1, Len(whichParent1) - chPos)
    Me![Also known as].SetFocus
    searchTxt = "[Also known as] = " & Chr(39) & whichParent1 & Chr(39)

    If rst.NoMatch Then
    Debug.Print "no match"
    End If
    End If

    Debug.Print searchTxt
    Me.Bookmark = rst.Bookmark

  2. #2
    Join Date
    Feb 2005
    Posts
    19
    You're not carryng out the Findfirst search a second time - you've gone back to the first record and remade your searchtxt variable but then not done a rst.FindFirst searchTxt once again.

  3. #3
    Join Date
    Nov 2004
    Posts
    35

    FindFirst

    Oh crumbs, that would do it, wouldn't it?

    Thank you so much
    Marion

Posting Permissions

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