I have a Autoexec macro setup on a Access 2016 database to determine which form to open based on Environ("USERNAME")
.
When I open the database I get a macro Error 2001. If I click Stop All Macros, I can continue using the database without issue, until I change the filename, then the issue happens again.
Are there any options to prevent this error from occurring?
The code being called is
LUser = LCase(Environ("USERNAME")) 'Get current username
DoCmd.OpenForm "frmDash", acNormal, , , , acWindowNormal
If IsNull(DLookup("[sysname]", "tblaccmannew", "sysname=" & "'" & LUser & "'")) Then
DoCmd.OpenForm "frmSearch", acNormal, , , , acWindowNormal
Forms!frmDash.Visible = False
End If