Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with FindFirst (Access 2003)

    I am stumped with the following code:

    Private Sub Form_Open(Cancel As Integer)

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim intCounter As Integer
    Dim strCounter As String

    'On Error GoTo Error_Form_Open

    Set db = CurrentDb
    Set rs = db.OpenRecordset("tblTransactions")

    intCounter = Forms!frmTransactions!txtTransactionSelected

    rs.FindFirst ("TransactionID = " & Str(intCounter))

    It fails on the FindFirst line with the error message Runtime error 3251 Operation is not supported for this type of object.

    This proc runs when an unbound editing form opens. It needs to collect its data from the record referenced in the variable txtTransactionSelected on the form frmTransactions. intCounter is picking up the expected transaction number. So why does FindFirst fail?

    Any help would be appreciated.

    David

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Problem with FindFirst (Access 2003)

    You haven't specified the recordset type, and unfortunately, the default is dbOpenTable, and this doesn't support FindFirst. Change the line that opens the recordset to

    Set rs = db.OpenRecordset("tblTransactions", dbOpenDynaset)

  3. #3
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Problem with FindFirst (Access 2003)

    Good morning Hans

    As ever, many thanks - this works as I want.

    David

Posting Permissions

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