Results 1 to 11 of 11
  1. #1
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81

    Unanswered: Can't find the records using combo box.

    Hey,
    I have adp front end, thats using sql server at back end.
    I wanna find a number from the database and wanna fetch all the records from the dtabse.
    The form is bound to the database
    but i m unable to find a specific record.
    it gives me
    "Object doesn't support this property or method."

    my code is


    Set rs = Me.Recordset.Clone
    rs.FindFirst "[id] = " & Me![cmb1132] ' it gives error here.
    Me.Bookmark = rs.Bookmark
    If rs.NoMatch Then
    MsgBox "Record does not exist, please make another selection."
    End If

    how can i solve this.
    Any idea,

    Thanks in advance

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    It's recordsetclone not recordset.clone
    Inspiration Through Fermentation

  3. #3
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    I tried but still there.

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Is rs dimmed as a dao.recordset?
    FindFirst only works on DAO
    Inspiration Through Fermentation

  5. #5
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    I tried with
    Find also
    then it stops on rs.NoMatch..

    Is there any other code that be the best fit for it.

  6. #6
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Again, it looks like your recordset is not explicitly declared as DAO.
    But then again, I don't use ADP, so it could be something I'm not familiar with.
    Inspiration Through Fermentation

  7. #7
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    Exactly I m doing this with ADO not in DAO.

  8. #8
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    set rs=me.recordsetclone
    rs.movefirst
    rs.find ....
    if rs.BOF (replaces no match)

    Sorry... It's between coffee time and Scotch time. I get a little slow then.
    Inspiration Through Fermentation

  9. #9
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    I have fixed that bug.
    The code i wrote with ado is

    Dim rs As New ADODB.Recordset
    Set rs = Me.RecordsetClone
    rs.MoveFirst
    Do
    If rs.Fields("id") = Combo1132.Text Then
    Me.Bookmark = rs.Bookmark
    Exit Sub
    End If
    rs.MoveNext
    Loop Until rs.EOF
    MsgBox ("Record with '" & Combo1132.Text & "' not found")

  10. #10
    Join Date
    Jul 2007
    Location
    Columbia SC
    Posts
    81
    Thanks 'RedNeckGeek' for your consideration though.

  11. #11
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    If you have a lot of records, that may take a while.

    Why not use
    rs.Find "[id]=" & combo1132
    if rs.bof or rs.eof then
    msgbox...
    else
    me.bookmark=rs.bookmark
    end if

    instead of looping thru every record?
    Inspiration Through Fermentation

Posting Permissions

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