set .ContolBox and .CloseButton to yes

Discussion in 'Microsoft Access Form Coding' started by Angi, Feb 14, 2005.

  1. Angi

    Angi Guest

    I know there's not a way to change the default view of a form
    programatically, but is there a way to change the CloseButton and
    ControlBox properties? They are currently No.

    Here's what I have:
    DoCmd.OpenForm "frmcustomersearch"
    With Forms!frmcustomersearch
    .CmdSwitch.Visible = False
    .ControlBox = True
    .CloseButton = True
    End With

    The CmdSwitch works, but the others don't. Just wondering if I'm doing
    it wrong or it's just not possible.

    TIA!
     
    Angi, Feb 14, 2005
    #1
    1. Advertisements

  2. Hi Angi

    Sorry, these two properties can be set only in design view.

    A workaround would be to disable them permanently, and provide your own
    Close button which you can show or hide as required.

    Another would be to intercept the close operation in the Unload event and
    cancel it if you don't want the user to use the close button at that time.
    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand

    "Angi" <> wrote in message
    news:...
    >I know there's not a way to change the default view of a form
    > programatically, but is there a way to change the CloseButton and
    > ControlBox properties? They are currently No.
    >
    > Here's what I have:
    > DoCmd.OpenForm "frmcustomersearch"
    > With Forms!frmcustomersearch
    > .CmdSwitch.Visible = False
    > .ControlBox = True
    > .CloseButton = True
    > End With
    >
    > The CmdSwitch works, but the others don't. Just wondering if I'm doing
    > it wrong or it's just not possible.
    >
    > TIA!
    >
     
    Graham Mandeno, Feb 14, 2005
    #2
    1. Advertisements

  3. Angi

    Rob Oldfield Guest

    You can only change them in design view. So it would be something like...

    DoCmd.OpenForm "frmcustomersearch", acDesign, , , , acHidden
    With Forms!frmcustomersearch
    .ControlBox = true
    .CloseButton = true
    End With
    DoCmd.OpenForm "frmcustomersearch"

    ....the hidden parameter is there to minimise the amount of screen flicker
    caused by opening the form in design view.


    "Angi" <> wrote in message
    news:...
    > I know there's not a way to change the default view of a form
    > programatically, but is there a way to change the CloseButton and
    > ControlBox properties? They are currently No.
    >
    > Here's what I have:
    > DoCmd.OpenForm "frmcustomersearch"
    > With Forms!frmcustomersearch
    > .CmdSwitch.Visible = False
    > .ControlBox = True
    > .CloseButton = True
    > End With
    >
    > The CmdSwitch works, but the others don't. Just wondering if I'm doing
    > it wrong or it's just not possible.
    >
    > TIA!
    >
     
    Rob Oldfield, Feb 14, 2005
    #3
  4. Angi

    Angi Guest

    OK...so let me get this straight. I can use the button on the form
    (already had that) or...

    Open the form, change the design, close the form, open the form to
    view, close the form, open the form, change the design back to No then
    close the form again?

    Won't that take a while? If so, I think I'll go with a button. Seems
    like a lot of code for a little X!

    Thanks guys
     
    Angi, Feb 14, 2005
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rowland

    YES, YES by george thats it

    Rowland, Aug 12, 2003, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    209
    Rowland
    Aug 12, 2003
  2. TC

    Re: CloseButton Property

    TC, Nov 21, 2003, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    224
  3. Jeff

    Form CloseButton property not working

    Jeff, Sep 23, 2004, in forum: Microsoft Access Form Coding
    Replies:
    5
    Views:
    602
    Graham Mandeno
    Sep 23, 2004
  4. R. Choate

    Closebutton

    R. Choate, Oct 15, 2005, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    197
    Ken Snell [MVP]
    Oct 15, 2005
  5. Guest

    Closebutton vs. DoCmd.Close

    Guest, May 30, 2007, in forum: Microsoft Access Form Coding
    Replies:
    11
    Views:
    483
    88Caddy
    Jun 6, 2007
Loading...

Share This Page