Manufacturing Information Solutions Forum Index Manufacturing Information Solutions
Your Place for Support and Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Loop through controls and change color

 
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> Microsoft Access
View previous topic :: View next topic  
Author Message
mistux
Site Admin


Joined: 25 Jun 2004
Posts: 1042
Location: South Bend, Indiana USA

PostPosted: Thu Oct 23, 2008 3:30 pm    Post subject: Loop through controls and change color Reply with quote

If you are like me and have an Edit button that changes the background color of my text boxes from gray to white then use this code to do that:

Code:

Private Sub btnEdit_Click()
On Error GoTo Err_btnEdit_Click

For Each ctl In Me.Controls
    If ctl.ControlType = acComboBox Or ctl.ControlType = acTextBox Then
         ctl.BackColor = RGB(255, 255, 255)  'White
       
    End If
Next


'FYI   RGB(216, 216, 216)  'gray
 

Exit_btnEdit_Click:
    Exit Sub

Err_btnEdit_Click:
If Err.Number = 438 Then Resume Next   'subform

    MsgBox Err.Description & " Number: " & Err.Number
    Resume Exit_btnEdit_Click
   
End Sub
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> Microsoft Access All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group