implementing VBA Recordset manipulation in MS Access when using TempVars
I'm a bit lost with I'm following best practices but I'm upgrading from an older version and I've been banging my head against this for hours. This might be a silly question, but Hey everyone, I'm running into an issue that's driving me crazy. I'm stuck on something that should probably be simple. I am working with an scenario when trying to manipulate a recordset in MS Access using VBA, particularly when I attempt to use TempVars to store some intermediate values. I created a form with a button that triggers an event to process records from a table. My goal is to set a TempVar value based on the recordset data and then use that TempVar in further processing. However, I'm running into a runtime behavior that states, "Invalid use of property" when trying to assign a value to the TempVar. Hereβs the relevant code snippet: ```vba Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("SELECT * FROM MyTable WHERE SomeCondition = True") If Not rs.EOF Then TempVars!MyTempVar = rs!SomeField End If rs.Close Set rs = Nothing ``` This worked fine before I added the TempVar line, and the recordset itself is being populated correctly. Iβve also checked that the TempVar is being declared properly in the TempVars collection. Iβve looked into the TempVars documentation and ensured that all references are correct. I also verified that the TempVar is not being set in a context where it want to be accessed. I would appreciate any insights on why I might be working with this scenario, and if there are best practices for using TempVars in conjunction with recordsets. I am using MS Access 2016, and I've confirmed that my database is in .accdb format. Any help would be greatly appreciated! My development environment is Windows. What's the best practice here? What's the best practice here? I'd really appreciate any guidance on this. My team is using Vba for this microservice. What are your experiences with this? This is part of a larger web app I'm building. How would you solve this? Could this be a known issue?