Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code help (Access 2000)

    This is part of the code I use to change a all the textboxes backcolor on a form if it's a new record. I have a combo box on the form that doesn't get changed though. How can I modify this code to have the combo box change as well as the text box. Any thought? Thanks..


    If Me.NewRecord Then
    For Each ctl In Me.Controls
    If ctl.ControlType = acTextBox Then 'Others include acLabel, acListBox, acComboBox, acCheckBox etc
    ctl.BackColor = 16777215

    End If
    Next

    Else

    For Each ctl In Me.Controls
    If ctl.ControlType = acTextBox Then
    ctl.BackColor = 13615474

    End If
    Next

    End If
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code help (Access 2000)

    Have you tried

    If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then

Posting Permissions

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