[AccessD] FindFirst Not Working

Rocky Smolin rockysmolin at bchacc.com
Sun Jul 12 15:37:15 CDT 2009


A.D:

Thanks for the simplification.  The one-liner works of course.  I suppose it
can be used where there's no possibility of a NoMatch as when you're pulling
the PK from a combo box where the row source is from the target table?

Rocky
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D.Tejpal
Sent: Sunday, July 12, 2009 10:49 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] FindFirst Not Working

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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list