Results 1 to 4 of 4

Thread: DAO & RecordSet Searching

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119

    Post

    I am presently accessing an Access DB using DAO. With the recordset open I would like to search through the already open recordset, choose a record, and fill my text boxes with the associated information from the rs. What would be the easiest way to do this. This is how I am trying to do it now:

    SearchStr$ = Search.Text
    rs.Index = CompName
    rs.Seek "=", SearchStr$
    If rs.NoMatch Then
    MsgBox "No match note", vbInformation
    End If

    Obviously this will not fill the associated text boxes but I cannot get it to search the recordset at all. I have the DB indexed on the CompName column in the table. Always get a run time error 3251.

    ANY HELP WOULD BE GREATLY APPRECIATED!

  2. #2
    Member
    Join Date
    Jan 2000
    Location
    Singapore
    Posts
    59

    Post

    Hai,
    Better see the help for Criteria in MSDN HELP.
    I did it last time to search a record . if it is there it will display in text boxes, other wise it will give the message.
    I was using datacontrol for this.
    If you are using recordset then just map the text box with the respective recordset fields.

    It will work.



    ------------------
    With regards,
    Karun

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    try rs.FindFirst

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Dayton, OH USA
    Posts
    119

    Post

    That did it. I sware I tried before and could not get it working, oh well. Here is a snap shot of the code for anyone else who may be having the same problem:

    findstring = "CompName = '"& Search.Text& "'"
    rs.FindFirst findstring
    If rs.NoMatch Then
    MsgBox ("User does not exist")
    Else
    MsgBox ("User does exist!")
    End If


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