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:
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?
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?
Last edited: