Related Topics

If Statement - Change Textbox Color

How to change color on text using IF
I would like to change color on the text placed in a textbox depending on the value. The value comes from a query connected to a table.

Something like:

in textbox: IF Me.ID = 30 THEN color = #FF0000
ELSEIF Me.ID = 40 THEN color = #00FF00
ELSE color = #000000


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?


Change color on text using column value?
How do I use a value in a column to make a textbox change color? I can explain what I mean:
Right now when a value in a column is supposed to be disabled, I have made the font color grey instead of black using conditional formatting. But this only works with the object it's connected to. So how do I do if I want do use col1 to control the color of col2?


Change color on text using column value?
How do I use a value in a column to make a textbox change color? I can explain what I mean:
Right now when a value in a column is supposed to be disabled, I have made the font color grey instead of black using conditional formatting. But this only works with the object it's connected to. So how do I do if I want do use col1 to control the color of col2?

I use Access 2000.


Update label visibility when record changes
I have a label which I want to set as visible when a textbox is greater than a certain value. When that textbox is less than the certain value, I want the label to not be visible.

I'm able to get it working with a command button using an If statement. With the same If statement, in the On Current event of the form, it will change to visible but when selecting a new record (via combo box) the label will stay, even if the textbox is below a certain value.

How can I get the label to change when selecting a new record like I can with a button? I have a feeling I'm missing something simple with where to put the If statement in some form event.

Working If statement on button:

Private Sub Command99_Click()
If Me.Text_Minutes < 1900 Then
Me.AgentMax.Visible = False
Else
Me.AgentMax.Visible = True


Changing bg color of textbox by different values entry
Here my little problem: I'm using ACCESS 2007 in order to build my first database.
I'd like to change the background color of a textbox "Categories" of my form "Products" if I change the value written in the textbox.
Conditional formatting is not ok for me because I need more than three colors.
I have only six different values I want to enter : A, B, C, D, E, F, and here the six related colors for the background color: green,blue,light blue,yellow,red,light red.
I think that I need some VBA code to write in but I'm a newbie in this field !
Can anyone help and give me the right solution so I'm going to complete my database ?


trying to add color to texboxes
On my forms, I want to have the background color on a textbox change when it is selected, then go back to default when you tab to the next textbox. Is there some generic code that will do this? I have up to 20 txtboxes per tab, and dont want to have to add code specifically for each box.


Changing bg color of textbox by entering different values
I'm using ACCESS 2007 in order to build my first database.
I'd like to change the background color of a textbox "Categories" of my form "Products" if I change the value written in the textbox.
Conditional formatting is not ok for me because I need more than three colors.
Here the six different values I want to enter : A, B, C, D, E, F, and the six related colors for the background : green,blue,light blue,yellow,red,light red.
I think that I need some VBA code to write in but I'm a newbie in this field


Checkbox question
Am new to this forum and fairly new to access but I am needing to have a checkbox, when clicked on a form, change the third character in a four character textbox. I have figured out how to "OnClick" of the checkbox change the color of the textbox in question but can't get the code right to change the text. When it is checked, I need the character to change from whatever it is, to a "G". I know I need to use the Replace function, but that is the extent of my current knowledge


Disabled textbox font color
I have some disabled textboxes in my forms to prevent the unwanted editing of data in my tables.

I have been unable to figure out how to change the color of the font in a disabled textbox,

I suspect with many things in access there is an alternative to preventing the unwanted editing, adding etc. of data in a table that is also a better approach in the development of a database. At this time I do not know if any what that alternative might be.


Change the text box color on form load
I may be asking for more then I am ready for. I have a Continuos form in access, so basically a list. I have one field in the table that is ColorCode and the value is 1, 2, or 3 and on the form the textbox is named txtColor. So on FormLoad, I want access to change the color of that text box to a new color based off the value. Now I think this is how it would look for a standard form:

Private Sub Form_Load()

If txtColor.Value = "1" Then txtColor.BackColor = green

End Sub

But how can I do this for a continuos form


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 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


Problem with a SELECT ... FROM ... WHERE statement
It stops after the 'SELECT' statement.

[CODE]

In that textbox a number is shown from a tabel/query (field is CreID), and that is an 'autonumber', formatted as Long Integer.

I have formatted the textbox as a number as well, but still nothing happens when running the code. If both textbox and CrewID are formatted as text, it work fine.

Problem is probably after the "=" sign in the SELECT statement.


Multiple Values in textbox
I am very happy to see a quality forum like this. Sorry for my bad English.

I have an issue about the data source of a textbox on a form. My access version is MS ACCESS 2007.

I have a sql statement that results a datasheet with one coloumn and more than one row. I want to view these results in a textbox with (,) or something like that between records.

For example,
sql statement

SELECT cars.Car_names FROM cars WHERE cars.age = "21"

This sql query results 10 records. And I want to list 10 car names in a textbox. ( I cannot use them in a listbox because of the structure of form)

Textbox should be like this : Renault, Mercedes, Audi, Porche

It doesn't matter what is seperating sign. (,) (-) or blank may be.

Is it possible a solution on access


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.


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


Conditional Back Color
We have a form with many subforms. On one of the subforms, there is a single text box (form is set to Continuous Form). When the form is loaded, that single textbox turns into many based onhow many rows are in the table populating it.

The problem is that we want to change the back/fore color based on the value in each of the text boxes. If we just use the following:

if Forms![parent form]![child form].Form![child form control name] = x then

....backcolor = vbgreen
....forecolor = vbgreen

end if

it looks at the first value, while ignoring all others and assigns a color. What we want is for it to instead look at each individual record and assign a color.

I have never used a For Each loop, The problem is that I haven't ever used one lol. I am not sure if it will even work.


Refresh unbound textbox
Using Access 2003… I have quite a bit of VBA code that runs a variety of queries. I display information to the user in an unbound textbox on the form. Something like this:
[code]

The problem is that (on some occasions) the queries will run without the text being displayed; I.e., the textbox will display “About to run queries” and then will display “Finished queries. I just couldn't see the textbox change, but this happens even when it takes a few moments for the queries to finish. E.g., I can see the queries running in the lower left-hand status bar, but the text will not change.

It’s almost like I need to put in a break (like a msgbox) to get the textbox to refresh—which works strangely enough? Or possibly to set the focus back to form/textbox?


Change the color of records in a table
Can you change the color of lines of records in a table in dependence from a check box? So if you list it in a specific subform or something like that it will be a different color? Is there another way of doing this and is there an example