Results 1 to 2 of 2
  1. #1
    mik is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    1

    Question finding record in recordset

    Hello,
    Could you please help me with finding record in recordset?
    When I use command
    Code:
     rs.Find "Waluta = USD"
    everytning works fine. When I try to use variable like this:
    Code:
    rs.Find "Waluta = " & kurs
    no data is find.



    Code:
    Sub FindKurs()
    Dim rs As ADODB.Recordset
    Dim kurs As String
    Set rs = New ADODB.Recordset
    kurs = "USD"
    rs.ActiveConnection = CurrentProject.Connection
    rs.Source = "tbl_kursywalut"
    rs.CursorType = adOpenDynamic
    rs.LockType = adLockOptimistic
    rs.Open
    rs.MoveFirst
    rs.Find "Waluta = " & kurs
    MsgBox rs![kurs]
    End Sub
    Thanks,

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Instead of find, would you rather just just build the where in a query...

    set rs = currentdb.openrecordset("select * from tbl_kursywalut where " & "[Waluta] = " & kurs

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Finding the Next record
    By rjbautista20 in forum Programming
    Replies: 15
    Last Post: 01-20-2012, 01:27 AM
  2. finding a record in a listbox
    By mgwat69 in forum Programming
    Replies: 2
    Last Post: 10-03-2011, 11:38 AM
  3. A way of finding a specific record
    By degras in forum Forms
    Replies: 8
    Last Post: 02-17-2011, 10:28 AM
  4. Finding a record
    By Rick West in forum Forms
    Replies: 3
    Last Post: 06-14-2010, 06:39 PM
  5. finding a value in a recordset
    By TheShabz in forum Programming
    Replies: 9
    Last Post: 04-23-2010, 02:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums