Find First Record (1 Viewer)

exaccess

Registered User.
Local time
Today, 21:57
Joined
Apr 21, 2013
Messages
287
Hi Everybody,
I am using ACCESS 2013. My recordsets and tables are all DAO. There are no indexes. But I can not run the FindFirst statement. Each time it says this method is not supported for this kind of object. Here is the code
Code:
 rs.FindFirst ("(rs.Fields('TeleCon') = TT)")
        If Not rs.NoMatch Then
            GoTo StoreValue
        Else
            rs.AddNew
            rs.Fields("TeleCon") = TT
            rs.Fields("Created") = Now
            rs.Update
            I = I + 1
            GoTo StoreValue
        End If
Please help.
 

Minty

AWF VIP
Local time
Today, 20:57
Joined
Jul 26, 2013
Messages
10,371
You would need to escape the TT with quotes - 'TT'
 

exaccess

Registered User.
Local time
Today, 21:57
Joined
Apr 21, 2013
Messages
287
Based on the two suggestions I tried Various alternatives such as
Code:
rs.FindFirst "[Tele].[Telecon] = 'TT'"
and
Code:
rs.FindFirst "[Tele].[Telecon] LIKE '*TT*'"
but I keep geting the same message with error number 3251.
 

Minty

AWF VIP
Local time
Today, 20:57
Joined
Jul 26, 2013
Messages
10,371
How are you opening your recordset? - Can you post up the whole code ?
 

exaccess

Registered User.
Local time
Today, 21:57
Joined
Apr 21, 2013
Messages
287
Code:
 Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim rt As DAO.Recordset
    Set db = CurrentDb
    Set rs = CurrentDb.OpenRecordset("Tele")
    Set rt = CurrentDb.OpenRecordset("TelephoneAAA")
 

sneuberg

AWF VIP
Local time
Today, 12:57
Joined
Oct 17, 2014
Messages
3,506
Not sure if it will help but I'd use the db variable you set like:

Code:
Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim rt As DAO.Recordset
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Tele")
    Set rt = db.OpenRecordset("TelephoneAAA")
 

Minty

AWF VIP
Local time
Today, 20:57
Joined
Jul 26, 2013
Messages
10,371
Not sure if it will help but I'd use the db variable you set like:

Code:
Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim rt As DAO.Recordset
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Tele",[COLOR="red"]dbOpenSnapshot[/COLOR])
    Set rt = db.OpenRecordset("TelephoneAAA",[COLOR="Red"]dbOpenSnapshot[/COLOR])

Try adding the bit in red.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:57
Joined
May 7, 2009
Messages
19,242
if TT is text:
rs.FindFirst "[TeleCon] = '" & TT & "'"

if TT is numeric:
rs.FindFirst "[TeleCon] = " & TT
 

Users who are viewing this thread

Top Bottom