I am trying to create a macro on a button that will close the form, store the last viewed record ID temparily, and the opens the form again displaying the last viewed record.
Why you ask? The record source is a SharePoint list and I am running some queries in the macro on that record. But it will not allow them to run until you close the form and reopen it. I don't understand the why, but I know if I run the query after making changes it will not work unless I close the form and open it again.
I tried having the macro save the record first then running the query, and that still doesn't work. The only thing I have found to work is to close it and reopen then the query will run perfectly. So I want to automate this step.
OR can you set a temporary variable of the current record ID, close the form, and use the temporary variable to run the query without opening the form again? If so what is the best way to do this?
Thank you