This should be easy...
On opening a continuous form for editing existing records, I want the cursor to land on the first record without a specific field filled in, so that the user can update the field without having to scroll down to it.
It appears that the code below is moving all the way through the recordset, since for example, if the query brings up 3 records, I get the message box 3 times. My problem is that it isn't updating the criteria for evaluating each record (it moves through each record with the criteria from the first), and always leaves my cursor on the first record no matter what.
What am I missing to get it to re-evaluate the criteria as it moves through the recordset? Here's the code:
Thank you!
On opening a continuous form for editing existing records, I want the cursor to land on the first record without a specific field filled in, so that the user can update the field without having to scroll down to it.
It appears that the code below is moving all the way through the recordset, since for example, if the query brings up 3 records, I get the message box 3 times. My problem is that it isn't updating the criteria for evaluating each record (it moves through each record with the criteria from the first), and always leaves my cursor on the first record no matter what.
What am I missing to get it to re-evaluate the criteria as it moves through the recordset? Here's the code:
Code:
Private Sub Form_Load()
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.MoveFirst
Me!Sent_to_CFacO_Date.SetFocus
Do While Not rs.EOF
If (Me!Sent_to_CFacO_Date) <> "" Then
rs.MoveNext
Me!Sent_to_CFacO_Date.SetFocus
MsgBox "Sent_to_CFacO_Date" & Me!Sent_to_CFacO_Date
Else
Exit Do
End If
Loop
rs.Close
Set rs = Nothing
End Sub
Thank you!