In Access 365 I have sub which opens a dynaset-type recordset based on a table, but it won't compile because it claims it "can't find" the fields in the records. It gives compile error 461, "Method or data member not found". Yet the fields are definitely there. Here is a simplified version of the sub:
The AccessAuthority table is defined thus:

If I comment out the first If block, the compile error shows on the second, and if I comment out the second, it shows on the third.
However, despite what it says, the compiler is evidently finding the fields in the table, because if I type them in all lower case or all upper case, it changes them to the capitalisation in the table definition. For example, it changes "rst.person id" to "rst.Person ID", "rst.KEY" to "rst.Key" etc.
Any suggestions gratefully received.
Code:
Private Sub DeauthoriseSTC( ) Dim rst As Recordset Set rst = CurrentDb.OpenRecordset("AccessAuthority", dbOpenDynaset) rst.MoveNext If rst.PersonID >1 Then DoEvents End If If rst.EventNum <> "" Then DoEvents End If If rst.Key = 0 Then DoEvents End If End Sub
If I comment out the first If block, the compile error shows on the second, and if I comment out the second, it shows on the third.
However, despite what it says, the compiler is evidently finding the fields in the table, because if I type them in all lower case or all upper case, it changes them to the capitalisation in the table definition. For example, it changes "rst.person id" to "rst.Person ID", "rst.KEY" to "rst.Key" etc.
Any suggestions gratefully received.
Comment