I have a form on which I want to do something in records that meet certain criteria. In my test code below, I loop through the recordset for the form, but my code sets the values for every record to the values appropriate to the first record. The code below sets Text304 on every record to True if "rst!DateEntered > #9/27/2018 9:02:36 AM#" is true for the first record and every record to false otherwise.
Right now I'm just writing to a text field to diagnose the problem, but what I want to do is to make a field on certain records editable. How do I do that?
Private Sub Form_Load()
Me.txtTitle.SetFocus
Dim rst As DAO.Recordset
Dim fld As Field
Set rst = Me.Recordset
Do While Not rst.EOF
If rst!DateEntered > #9/27/2018 9:02:36 AM# Then
Text304 = "True"
Else
Text304 = "False"
End If
rst.MoveNext
Loop
Me.Refresh
End Sub
with DAO, you must remember to populate the Recordset as it only takes the records that have already been accessed