changing controls specialeffect at runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • questionit
    Contributor
    • Feb 2007
    • 553

    changing controls specialeffect at runtime

    Hi

    I used this code to change the special effect of the controls.
    After this, the form is saved.

    [code=vb]
    Dim ctl As Control

    For Each ctl In Me.Controls
    If TypeOf ctl Is ComboBox Then
    ctl.SpecialEffe ct = 0
    ctl.BorderColor = RGB(255, 128, 140)
    End If
    Next ctl

    DoCmd.Save acForm, "Form1"
    [/code]


    When i close the form and re-open it ,all the changes are not there.

    Why does it do that when i save the form as well from code itself ?

    Thanks
    Qi
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Change

    DoCmd.Save acForm, "Form1"

    into

    DoCmd.Close acForm, "Form1", acSaveYes

    And tell me the result. Make sure that the form is open in edit mode when running the code !

    Nic;o)

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      The DoCmd.Close acForm, "Form1", acSaveYes

      part is correct, but I think the changes have to be made while the form is in Design View, not while the it's being used in the normal fashion.

      Linq ;0)>

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        Well detected hawkeye Linq. Should have used "Design View" instead of "edit mode" <LOL>

        Nic;o)

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          I figured that was what you meant!

          ;0)>

          BTW, did you once upon a time belong to those mercenary guys over at Experts-Exchange (knowledge for money)?

          Comment

          Working...