Go to next record if current record is complete

JiTS

Ciao!
Local time
Today, 19:44
Joined
Dec 12, 2003
Messages
77
Hi,

I have two forms in my database:
Form1: list of records (which have the status 'open')
Form2: shows details of chosen record in Form1 (status can be set on 'complete')

When the status in Form2 is changed into 'complete' this record will disappear in Form1. If the status stays on 'open' the focus goes back to the same record in Form1. For this I use the following code in the event 'Form_Close' in Form2:

Code:
Public RecordID As String

Private Sub Form_Close()

       RecordID = Forms![Form1]!txtID

       Forms![Form1].SetFocus
       DoCmd.Echo False
       DoCmd.Requery
       Forms![Form1]!txtID.SetFocus
       DoCmd.FindRecord RecordID
       DoCmd.Echo True
       
End Sub

Everything goes well when the status stays on 'open'. When the status is 'closed' it's not able to found the record in Form1 because it's out of the list.

I want to build in a loop that automatically seeks for the next record.

Can someone help me with this issue? :o
 
Last edited:
Sorry, but that solution will not work.

I still think that I need a loop to check if the next recordID exists in the list of records!?!
 
Ok, thanks for the guideline... but can you give me a more specific solution for this issue?
 

Users who are viewing this thread

Back
Top Bottom