Check if MS Accees form is in Design view

Posted on 2009-04-29
Last Modified: 2013-11-28
I was wondering if anyone knew how to check if a form is open in design view. I have a function that I call to check if the form is open and it works OK. The problem is that the form is open in design mode, the code still returns True. If the form is in design mode, I want the function to return False.

Private Function IsOpen(strName As String,  Optional lngObjectType As AcObjectType = acForm)

    ' Returns True if strName is open, False otherwise.

    ' Assume the caller wants to know about a form.

    IsOpen = (SysCmd(acSysCmdGetObjectState, lngObjectType, strName) <> 0)

End Function

Open in new window

Question by:Sandman2
    LVL 44

    Accepted Solution


    yields 0 if opened in design view
    LVL 44

    Assisted Solution

    Press Alt+F11 to get to the VBA Editor window and enter - currentview - in the Help window.  Its all there.

    Author Closing Comment

    Thanks for the help. That works perfectly. Split the points b/c the second comment went beyond my initial comment.
    LVL 44

    Expert Comment

    Thanks, glad to help.  Remember, Help is a terrific source of info - especially over on the VBA side of things.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now