Home>
The records in the table are displayed in the form form
<>
I want to display only records that match certain conditions in a form with a different background color
If there is a record with "A" in [Field name 1],
I want to change the background color of the form where the record is displayed.
When I wrote the following code as a test, it was not reflected.
I wanted to change the code, but I'm not sure where to change it.
If i have a good method, please let me know.
Private Sub Form_Load ()
Dim SQL1 As String
SQL1 = ""
SQL1 = "SELECT [table name]. [Primary key field]"
SQL1 = SQL1&", [table name]. [Field name 1]"
SQL1 = SQL1&", [table name]. [Field name 2];"
Forms! [Form name for display] .RecordSource = SQL1
Forms! [Form name for display] .Form.Requery
If [Form name for display]. [Control name 1] = "A" Then
[Form name for display] .Details.BackColor = RGB (204, 255, 204) 'Light green
End If
End Sub
-
Answer # 1
Related articles
- javascript change the background color according to the displayed characters
- css3 - i want to change the background color except for a specific class
- ios - home screen background color change and persistence using igcolorpicker
- html - i want to change the background color of the send button according to the number of characters input in the input tag
- vuejs - i want to change the background color of vuetify's v-card-text to white or another color
- javascript - table: i want to change the background color when clicking and mouse over
- i want to change the background color of the file selected in the view of eclipse
- php - i want to change the background color of the table row and keep that state
- java - i want to change the background color of a row in a thymeleaf table under certain conditions
- javascript - i want to change the background color of the cell with gas
- python 3x - i want to change the background color of the specified line in python3 tkinter treeview
- html - [beginner] i can't change the background color of the header
- vba - access tabular form change the text color for each record depending on yesno of the check box of each record
- i want to change the back color when there is no product code in access
- css - i want to change the background color and boeder of wordpress
- c++ - i want to change the background color of qt label without affecting other settings
- html - the background color of background-image does not change
- php - i want to change the background color and text color when creating a multiplication table
- i want to change the background color of the character string selected in javascript
- i want to change the background color of the panel of the date registered in vbnet homebrew calendar
Trends
Because the "Background color" property is not included in each record, even if it is changed in VBA, it is reflected in all records. It is impossible to change the background color for each record.
Use conditional formatting to change the format for each record.
Only text boxes have "conditional formatting", so place a text box of the same size as the section on the back and set the background color in the conditional formatting.
Example of conditional formatting