[AccessD] FindFirst Not Working

A.D.Tejpal adtp at airtelmail.in
Sun Jul 12 12:49:20 CDT 2009


Rocky,

    Whenever you call Me.RecordsetClone, it is a new instance with bookmark at first record. Therefore your third statement, setting form's bookmark equal to that of its RecordsetClone does not derive any benefit from the FindFirst action performed on the other clone in very first statement. Instead, you are merely taking the form to first record.

    Note: Apparently you meant RecordsetClone (and not Recordset.Clone) in the first statement.

    Two alternatives are available to you:
    (a) At the very beginning, set a pointer to RecordsetClone and refer to that only in remaining part of the code, as already pointed out by Jürgen.

    (b) Adopt drastically simplified one line approach, using form's recordset directly as follows:

          Me.Recordset.FindFirst  "<<Criteria String>>"

Best wishes,
A.D. Tejpal
------------

  ----- Original Message ----- 
  From: Rocky Smolin 
  To: 'Access Developers discussion and problem solving' 
  Sent: Sunday, July 12, 2009 19:17
  Subject: [AccessD] FindFirst Not Working


  Dear List:

  Legacy app.  I added a form to make purchase orders. In the AfterUpdate
  event of the combo box which finds an existing purchase order I added the
  following:

  Private Sub cboFindPO_AfterUpdate()
      Me.Recordset.Clone.FindFirst "fldPOHID = " & Me.cboFindPO.Column(0)
      MsgBox Me.RecordsetClone.NoMatch
      Me.Bookmark = Me.RecordsetClone.Bookmark
      Me.Refresh
  End Sub

  But the form does not move to the selected Purchase Order.

  I put in the MsgBox just to make sure NoMatch was False.  I added the
  Refresh to see if that was the problem.

  Does anyone see a reason why this shouldn't work?  

  MTIA,

  Rocky


More information about the AccessD mailing list