Share via

Method 'Item' of object 'Forms' failed.

Anonymous
2019-01-10T14:07:41+00:00

I am using Access 2016. I have a function that checks if a form is open. The same code has been used for years with no issues:

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then

If Forms(strFormName).CurrentView <> conDesignView Then

IsLoaded = True

End If

End If

All of a sudden it is failing with the message "Method 'item' of object 'Forms' failed." on the line If Forms(strFormName).CurrentView <> conDesignView Then. I have stepped through the code in debug mode and it works fine. As soon as I try to run I get an error...

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2019-01-10T14:21:25+00:00

    I found the issue. Another problem elsewhere was causing the code to fail. When I fixed what I thought was a non-related error the problem went away...

    Was this answer helpful?

    0 comments No comments