Re: Find and Find Next

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Rob wrote:

I have a form that pulls multiple records based on a combo box and the
records are displayed in the form. The user then proceeds to enter data. I
want to set up as part of my closing of the form a find record that matches
certain criteria and the cursor goes to that record. The criteria is
"ChkUnaccept = Yes and TxtOccur = 0". The user corrects the error and then
clicks the close button to see if there are any others. If there are then
the cursor goes to the next record where this occurs until it doesn't find
any more and then a macro is run. I just need the code to have the record
found until it goes to the End of the form and finds no records.


First, you need to save any changes to the current record.
Then you can use the FindFirst (DAO) or Find (ADO) method to
check the form's records.

The form's Unload event would look like:

If Me.Dirty Then Me.Dirty = False
With Me.RecordsetClone
.FindFirst "ChkUnaccept = Yes And TxtOccur = 0"
If Not .NoMatch Then
Cancel = True 'prevent form from closing
Me.Bookmark = .Bookmark
Enf If
End With

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • RE: Find and Find Next
    ... In a command button click event have the following: ... Do Until .EOF ... certain criteria and the cursor goes to that record. ...
    (microsoft.public.access.formscoding)
  • Re: reset SQL to reprocess a subfile in an inquiry program(SQLRPGLE)
    ... When your criteria changes you need to Close the cursor, ... SQL subfile programs. ... I use open/fetch/close each time criteria changes. ...
    (comp.sys.ibm.as400.misc)
  • Re: reset SQL to reprocess a subfile in an inquiry program(SQLRPGLE)
    ... You don't need to declare it again, ... cursor generates no executable code. ... When your criteria changes you need to Close the cursor, ... I use open/fetch/close each time criteria changes. ...
    (comp.sys.ibm.as400.misc)
  • Re: Computer being taken over
    ... > My computer will be working fine and all of a sudden the cursor starts ... random programs are opening and closing. ...
    (microsoft.public.win2000.general)
  • Computer being taken over
    ... My computer will be working fine and all of a sudden the cursor starts ... random programs are opening and closing. ...
    (microsoft.public.win2000.general)