"ADODC.recordset.find" Method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    "ADODC.recordset.find" Method

    in my code i am using this syntax:

    Code:
    Private Sub mnuName_Click()
            Dim str As String
            Adodc1.Recordset.MoveFirst
            str = InputBox("What Name Can I Find For You......?", "Who Name Can I Search For You Today?")
            Adodc1.Recordset.Find "lessorsname='" & str & "'"
    End Sub
    But the problem is what if the name doesn't exist what Code can i use for this?

    lee123
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    what you want to return if the record does not exist ?

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      A msgbox that says " Sorry No Match"

      lee123

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        After FIND, Check EOF of the recordset..
        Try this :

        [code=vb]
        Private Sub mnuName_Click()
        Dim str1 As String
        Adodc1.Recordse t.MoveFirst
        str1 = InputBox("What Name Can I Find For You......?", "Who Name Can I Search For You Today?")
        Adodc1.Recordse t.Find "lessorsnam e='" & str1 & "'"
        If Adodc1.Recordse t.EOF Then
        MsgBox "No Records Found... Try Again"
        Else
        MsgBox "Records Found"
        ' Code To Populate Textboxes..
        End If
        End Sub

        [/code]

        Regards
        Veena

        Comment

        Working...