Results 1 to 9 of 9

Thread: Property 'Sheet' Window - How to close?

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Property 'Sheet' Window - How to close?

    Hi,

    Access 2003
    As far as I can recall, access 2000 and 97 never had the properties sheet re-appearing from design to showing the form. As an upgrade (for some unknown reason) MS have decided to make it appear if you had it open last time (any database) and didn't close it when on a form.

    By any database I mean, that if you have a fairly secure db and you have the properties sheet closed, then close it - go to a new db open a form, open the properties window, close the form (save if neccessary). Reopen the 'secure' db and when a form opens, so does the properties sheet.

    I know you can just close the sheet, but if a user opened the db and got the properties sheet, they may be inclined to uh nose around ... and in doing so accidentally delete something.

    Anyone have a link or some code to get to the properties sheet and close it?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Property 'Sheet' Window - How to close?

    I have seen this issue before too. I guess you just need to make sure that when saving a form's changes from design view, you need
    to make sure you close the prop window first.

    I suppose you could use the FindWindow, FindWindowEx, and SendMessage APIs to find the window handle of the property window so you
    can sendmessage to it telling it to close.

    I'll take a look and see if there is a built in method in Access for this though.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Property 'Sheet' Window - How to close?

    First try at stopping it.... sort of... Still working on it.
    Code:
        Dim cbr As CommandBar
        Dim cbp As CommandBarPopup
        Dim cbc As CommandBarControl
        
        On Error Resume Next
        
        Set cbr = CommandBars("menu bar")
        Set cbp = cbr.Controls("&View")
        Set cbc = cbp.Controls("&Properties")
        
        cbc.Execute
        
        If Err.Number <> 0 Then
            MsgBox "Error : " & Err.Number & vbCrLf & Err.Description, vbOKOnly + vbExclamation, "Error"
        End If
        
        Set cbp = Nothing
        Set cbc = Nothing
        Set cbr = Nothing
    Weirdly - if you put a breakpoint in and the execute line it errors (I guess it somehow is confused and is now looking at the vb editor menu - or just doesn't like you going into debug it when its running.

    Still looking for the property of the control to say if it is toggled or not.

    Attempt number one

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Property 'Sheet' Window - How to close?

    i tried this in excel, (don't have access)

    AppActivate "Properties", True
    SendKeys "%{F4}", True

    pete

  5. #5

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Property 'Sheet' Window - How to close?

    West:
    But how do you check whether it is open or not?
    Wouldn't the send keys close the sheet/db if it was open before all the calls?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Property 'Sheet' Window - How to close?

    in excel at least if appactivate finds no window with title "Properties" it generates and error, if you just handle the error to exit sub or skip a line, then it will do nothing

    pete

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Property 'Sheet' Window - How to close?

    There are several toolbar buttons/menu items that are protected from automation. The property button is probably one of them.

    Like I posted earlier, the FindWindow & FindWindowEx APIs will do the saerching part for the property window. TheSendMessage API can send
    the command to close the property window if FindWindowEx finds it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Property 'Sheet' Window - How to close?

    Just had a quick experiment with FindWindowEx .. looks hmm ok but the properties window doesn't have a title/caption of Properties - can MS make it any harder?
    The title/caption is of whichever control it is in on opening... Or at least was here when I tested it.

    Thanks though - I'll think on it some more...

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Property 'Sheet' Window - How to close?

    Since the prop window has a caption but it all depends on what was selected when the prop window was last closed, you could
    just search for the class name only - "OArgDlg"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width