Please post code within CODE tags to retain indentation and readability.
rst = Nothing because the Set rst line has not yet executed. Put breakpoint on the line following Set rst. Then when hovering over the rst variable the popup will not appear because it cannot show recordset content.
I still don't understand how dynamically setting Tag property is useful.
A BOUND subform on an UNBOUND main form can be useful. I have done that. However, you are populating an UNBOUND form because your data structure is not like the form?
If you want to cycle a recordset it must be Set outside the loop. Example:
Code:
Dim rst AS DAO.Recordset, x As Integer
Set rst = CurrentDb.OpenRecordset("SELECT * FROM ...")
For x = 1 To 75
Me.Controls("txtClassNum" & x) = rst!Teacher & ...
rst.MoveNext
Next x
rst.Close
The code presumes there will always be 75 records in the correct order to coincide with the control name sequence. If you are filtering the recordset to a single record then it can be set within the loop and must also Close it instead of the MoveNext. However, one call to open recordset is probably better than 75.
Provide your attempted DLookup() if you prefer that method. Domain aggregates can perform slowly with large dataset (again, 75 calls to pull data). Your SQL statement in post 1 has apostrophe delimiters for the parameters but the image does not - which is correct?
We could better advise if you described your data structure. If you want to provide db for analysis, follow instructions at bottom of my post.