Results 1 to 2 of 2

Thread: Help with vb code for a simple form

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2007
    Posts
    21

    Help with vb code for a simple form

    at the moment i enter a reference in a combo box and the code then returns in datasheet view the first record it finds for that refernence in the record set

    Private Sub Combo68_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[EXTERNAL_REF] = '" & Me![Combo68] & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub

    What i want to do is find all the records that match that reference does anyone know how to do this?

    Is there a simple rs. function that can do this for me that i simply do not know about?

    Many Thanks

    Dan Stead

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Help with vb code for a simple form

    To find all of the records you may be able to use a Filter (I'm not quite sure how, as I don't use it myself), or you could simply re-open the recordset with a Where clause that contains your condition, eg:
    Code:
    Me.Recordset.Close
    Me.Recordset.Open "SELECT * FROM tablename WHERE [EXTERNAL_REF] = '" & Me![Combo68] & "'"

Posting Permissions

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



Click Here to Expand Forum to Full Width