Change TextBox BackColor to Transparent

I've seen a lot of messages asking how to pro grammatically change the color of a TextBox to a color, but not on how to do the reverse. If in my form or in my code, I have the BackClolor set to red, how do I pro grammatically change it to be transparent?

Sponsored Links:

Related Topics

A code to change textbox property in a form?
how to change a textbox properties in a form, I have seven textboxes named Sat,Sun,Mon. and I wrote the below code to find the current day:
Dim Today As String
Today = Format(Date, "ddd")
What Im looking for is a code to change the textbox BackColor for the textbox that matches the value returned by the above code.


Change text box backcolor conditionally
I have an Access 2010 database to hold employee data and I have a report to flag when a performance review is coming up, overdue or done.

The textbox (Date/Time type) that holds the review date is called [ReviewDate]. I use conditional formatting to turn the backcolor yellow if the date is less than 30 days from now, and that works.

I want the backcolor on the report to be red. If the value of the checkbox [ReviewDone] is yes, indicating the review has been completed, I want the backcolor to be white.

I'm not using conditional formatting for the red backcolor because it seems to take priority and ignore any VBA code about turning white if the box is checked.

So I wrote what should be simple code and put it in the report's Current event property, but absolutely nothing happens.


Flash Textbox Backcolor White and Red
I have searched for code to flash the backcolor of a text box but haven't found what I want. I am sure it is a simple timer but I know just enough to be dangerous.

If a user changes a date in a text box (SubmitDate) on form 1 and tabs out of the field, I have code in the AfterUpdate event to update this date change on a text box on form 2 (that is also open) so they stay in sync. I have some code that changes the backcolor of the text box on form 2 to red, then changes it to white, then red again and then back to white so it appears to flash, but it is very inefficient. Is there a simple way to alternate the backcolor from white to red, to white, to red, then back to white with a 1/2 second interval between each color change? I am using DoEvents so I can continue other processes while it changes color


Simple backcolor vba code returns error
I need a bit of help getting the syntax of a line of code that would change the backcolor on a subform. I have this, but it yields an error

If Me.tglInstallationNoteFlag = False Then
Me.chldInstallationNotes.Detail.BackColor = NormalColor


Backcolor of detail section
How can I change the backcolor of the detail section by group in my report of Access 2003? Now I have different backcolor per row.


Flash Textbox Backcolor White and Red
I have searched for code to flash the backcolor of a text box but haven't found what I want. I am sure it is a simple timer but I know just enough to be dangerous.

If a user changes a date in a text box (SubmitDate) on form 1 and tabs out of the field, I have code in the AfterUpdate event to update this date change on a text box on form 2 (that is also open) so they stay in sync.

I have some code that changes the backcolor of the text box on form 2 to red, then changes it to white, then red again and then back to white so it appears to flash, but it is very inefficient.

Is there a simple way to alternate the backcolor from white to red, to white, to red, then back to white with a 1/2 second interval between each colorchange? I am using DoEvents so I can continue other processes while it changes color.


Change Row Background Color Programmatically
I have a report and I want the backcolor to change based on the value in a field named color. Here is the code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.Color
Case Purple
Me.Detail.BackColor = RGB(204, 204, 255)
Case "Green"
Me.Detail.BackColor = RGB(204, 236, 255)
Case Yellow
Me.Detail.BackColor = RGB(255, 255, 204)
Case Blue
Me.Detail.BackColor = RGB(204, 236, 255)
Case Orange
Me.Detail.BackColor = RGB(255, 204, 153)
Case Grey
Me.Detail.BackColor = RGB(221, 221, 221)
Case Else
Me.Detail.BackColor = vbRed
End Select
End Sub

This has no effect. However I was able to change the background color of a box set behind the other fields with this code. The problem was that it set all fields to the value from the last box


Creating a mouse hover event
I am trying to make the textbox change color when mouse is run over the button and then go back to the default color. at the moment it changes color to red when mouse is over, but it does not change back. does anyone know how to do this?

Private Sub Text11_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Me.Text11.BackColor = vbRed

End Sub

Private Sub Form2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Me.Text11.BackColor = vbBlack


Access 2010: Setting Report Textbox Backcolor from Field Condition
I have an Access 2010 Report in which I'd like to be able to set the Textbox Backcolor property based on the condition of another field value within the same record of the Report.

For example:

I've tried the following code in the Report Event Procedures "On Load" and "On Open" but it does not work


Setting a Color on a Control For Error
I have a continuous form. I can add/change/delete. When I add a record I try to set the backcolor to red. However all of the controls for the text box are set to red. I just want to change the backcolor of that one control to red. How can I do that?

Here is the snippet of code. Hexcolor is a subroutine which sets the color to red.

ElseIf IsNull(Me.SchTime) Then
Response = MsgBox("Please enter the time", vbInformation)
Me.SchTime.SetFocus
Me.SchTime.BackColor = HexColor("CC


Conditional Formatting w/ Two Criteria
I need to conditionally format a textbox on a form based on two sets of criteria. The textbox needs to test false for IsDate() and another field requires a value greater than 4. The code I have sets all textboxes on the continuous form to the same color. The code is below. Also, the code is set to run AfterUpdate. How would I set this to conditionally format when the form loads?

Private Sub Stage5Walk1_AfterUpdate()
If Me.MaxOfSTAGE.Value > 4 Then
If Not IsDate(Me.Stage5Walk1.Value) Then
Me.Stage5Walk1.BackColor = vbBlue
Else
Me.Stage5Walk1.BackColor = vbWhite


Color/font change in subform
Is it possible to change forecolor or backcolor of a field on a subform? Changing them in a form was no problem. Here is teh code I used.

Select Case Me.txtColorCntl.Value
Me.[Form - Child].Form.Points.BackColor = 65535
Me.[Form - Child].Form.Points.FontSize = 14
Me.txtColorCntl.BackColor = 65535
Me.txtColorCntl.FontSize = 14
End Select
Me.[Form - Child].Requery


Color setting in VBA
I tried to use this on an AfterUpdate on a textbox Control -

If A>B Then
Me!Control.BackColor=255
Else
Me!Control.Backcolor=#FFFFFF
End If

I want it the background to red if A>B and to remain white otherwise but all I get is a black background when it should be white. I tried using the new 2010 convention of Background 1 with and without quotes but nothing seems ot work.
In 2003 you used to get a decimal or hex number option when you used the color picker but that doesn't seem to be the case now.


Conditionally Formatting a SubForm's Background
I have successfully used the code included below to change the background color of form contingent upon the team chosen in a combo box from the 16 possible teams.

I have two questions:

Is there a way to transfer that conditionally chosen color to the backgrounds of the 5 subforms in this form? I've not been able to work that out.

Is there a simpler technique to get the same results on the base form conditional formatting?

Private Sub Form_Current()
If Me.comboMLBTeamID.Value = 1 Then
Me.Detail.BackColor = RGB(237, 210, 24)
ElseIf Me.comboMLBTeamID.Value = 2 Then
Me.Detail.BackColor = RGB(149, 206, 234)
ElseIf Me.comboMLBTeamID.Value = 16 Then
Me.Detail.BackColor = RGB(238, 188, 38)
Else: Me.Detail.BackColor


Conditional Formatting
Was wondering if someone could help me

If written a conditional format code on VB for a form. The code is 'Select Case' which changes the colour of a rectangle (Box17) depending what is in Field1.

However the problem I'm having is that when I click on a record all the rectangle's change, rather than being specifc to that particular record. For example I would like each record to have a different colour rather than them be all the same.

The picture attached shows the problem I'm having. Level 1 field is green, However level 2 field isnt Red unless I click on it, but then all the rectangles change to red.

Private Sub Form_Current()
Select Case Field1
Case "Level 1"
Box17.Properties("Backcolor") = vbGreen
Case "Level 2"
Box17.Properties("Backcolor") = vbRed
Case "Level 3"
Box17.Properties("Backcolor") = vbYellow
Case "Level 4"
Box17.Properties("Backcolor") = vbBlack
Case Else
Box17.Properties("Backcolor") = vbBlue


Access 2007 - Change Backcolor Of Specific Labels
I have a series of labels on an Access Form.

Depending on the labels caption, I need to change the backcolor.

The first 5 characters of the labels will be the same (Cap x).

Example:
Cap 1-1
Cap 1-2
Cap 1-3
Cap 1-4
Cap 1-5

Cap 2-1
Cap 2-2
Cap 2-3
Cap 2-4
Cap 2-5

I want to change all labels where the number portion begins with 2, so I do this

Private Sub Command1_Click()
Dim ctrl As Control
For Each ctrl In Forms("NameOfForm").Controls
If TypeOf ctrl Is Label Then
If ctrl.Caption Like "Cap 2" Then
ctrl.BackColor = vbBlue
ctrl.ForeColor = vbWhite
End If
End If
Next
End Sub

All of the labels have their backstyle set to Normal.

The problem is that none of the labels are getting their backcolors changed. I put a break on the code and stepped through it.it is finding the controls on the form that are labels, but it is not find the label controls that have a caption like Cap 2.


Change text in the textbox to propercase
I have a textbox that stores customer name so when the user starts typing the text in that textbox then it should convert into vbpropercase that means first letter capital and then rest of the letters small.:
If I use the following code on change event of the textbox then it doesn't work and Infact the textbox doesn't allow me to input anything:

textbox1=strconv(textbox1,vbpropercase


Report Highlight IF
So, I found this piece of code online and want to use it in a Report:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

'Set the backstyle to normal (default is usually transparent)
DIVISION.BackStyle = 1

If DIVISION = "1" Then
DIVISION.BackColor = vbRed

Else
DIVISION.BackColor = vbWhite
End If

End Sub

The difference is that I would like to Highlight Division if it is selected from a Listbox (name?) on a form control. The form control provides a parameter for a query, and the query provides the data for the report. So, if the user selects "Division 1" on the form control, "Division 1" will be highlighted on the report


Dynamically set Backcolor property
In a Tabular subform I would like to dynamically set the Backcolor property of field "A". The Backcolor value is stored in field "B" which derives the Backcolor value via DLookup from field "C". All 3 fields are in the same record. Maybe field "B" is not needed


SelStart not accounting from spaces?
So I have a textbox in the header of one of my forms. For it's On Change event I have it filtering the form based on whatever is entered in the textbox. This works great. However, after the filter is re-applied after each "change", I have SelStart code to place the cursor back in the textbox.

Problem is that SelStart does not seem to be accounting for any spaces in the textbox, and continues to place the cursor after the last character - not space - in the textbox.