Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2006
    Posts
    15

    Unanswered: How to Programmatically Change the "Control Box" property in VB?

    Here's my code:

    Private Sub Form_Load()

    Forms!SwitchBoard.Modal = False
    Forms!SwitchBoard.ControlBox = True

    .
    .
    .


    When the form is launched I get "Runtime Error '2448': You can't assign a value to this object"


    I looked all over the web and it seems like 98 percent of the examples for setting properties values are based on setting the visible property from true to false and back again.

    I'm sure whatever I'm doing wrong must be incredibly silly - but I don't know what it is ...

    Anyone got any friendly advice?

    Thanks,

    Daniel

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Check the help file:
    ControlBox Property

    You can use the ControlBox property to specify whether a form has a Control menu in Form view and Datasheet view.

    Setting

    The ControlBox property uses the following settings.

    Setting Visual Basic Description
    Yes True (1) (Default) The form has a Control menu in Form view and Datasheet view.
    No False (0) The form doesn't have a Control menu in Form view and Datasheet view.


    Note Setting the ControlBox property to No also removes the Minimize, Maximize, and Close buttons on a form.

    You can set this property by using the form's property sheet, a macro, or Visual Basic.

    You can set this property only in form Design view.

    Remarks

    To display a Control menu on a form, the ControlBox property must be set to Yes and the form's BorderStyle property must be set to Thin, Sizable, or Dialog.

    Even when a form's ControlBox property is set to No, the form always has a Control menu when opened in Design view.

    Setting the ControlBox property to No suppresses the Control menu when you:

    Open the form in Form view from the Database window.

    Open the form from a macro.

    Open the form from Visual Basic.

    Open the form in Datasheet view.

    Switch to Form view or Datasheet view from Design view.

  3. #3
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Quote Originally Posted by daraphaelQODBC
    Anyone got any friendly advice?
    If you use a different form to open this form in design view hidden, you can set the property and then open it and make it visible.

    have fun,
    tc

  4. #4
    Join Date
    Feb 2006
    Posts
    15
    Quote Originally Posted by tcace
    If you use a different form to open this form in design view hidden, you can set the property and then open it and make it visible.

    have fun,
    tc
    Ok, thanks, that's the piece I was missing!! :-)

  5. #5
    Join Date
    Jun 2010
    Posts
    9
    Thanks for the thread.

    This is helpful, but it also means that this can be set in an MDE, ACCDE or ADE where putting a form into design mode is not an option. Bummer.

Posting Permissions

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