Share via

FindFirst error

Anonymous
2017-02-28T20:57:51+00:00

The code below generates the error "Runtime error 3251. Operation is not supported for this object type" on the line

rst.FindFirst "[Costume Number] = '205-001'"

I am new to Access and must be doing something dumb but I cannot find what I am doing wrong. Help will be appreciated. Thanks.

Private Sub Show_Costume_Description()

Dim dbs As DAO.Database

Dim rst As DAO.Recordset

'Get the Costume table recordset.

Set dbs = CurrentDb

Set rst = dbs.OpenRecordset("Costume")

'Find the Costume record for the current Checkout

'table record.

rst.FindFirst "[Costume Number] = '205-001'"

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2017-02-28T22:29:50+00:00

    If "Costume" is the name of a table, not a stored query, then the recordset opened by

       Set rst = dbs.OpenRecordset("Costume")

    will be a table-type recordset, and the FindFirst method is not supported for that type of recordset.  As Mimmo and Daniel have suggested, you can make the recordset be a dynaset by either opening the recordset on a query, or by specifying the dbOpenDynaset option when you open it.

    Was this answer helpful?

    5 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2017-02-28T22:12:47+00:00

    Did you try opening the recordset as a dbOpenDynaset or dbOpenSnapshot? Thedocumentation on the Microsoft MSDNsite specifies it takes one of those two recordsets:

    "Locates the first record in a dynaset- or snapshot-type Recordset object that satisfies the specified criteria and makes that record the current record"

    Try:

    Set rst = dbs.OpenRecordset("Costume", dbOpenDynaset)

    Was this answer helpful?

    5 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2017-02-28T22:09:31+00:00

    Hi,

    change your code into:

    Set rst = dbs.OpenRecordset("Select * From Costume")

    Ciao Mimmo

    Was this answer helpful?

    4 people found this answer helpful.
    0 comments No comments