Rich Text color problem for drop down menu (1 Viewer)

Parrot215

New member
Local time
Yesterday, 17:31
Joined
Oct 24, 2018
Messages
9
Good Morning. I have a problem with my MS Access data program. I am trying to make a three word drop down menu to show one of the words in color (red) and the rest of the two words in black.

Main table with the records are at: "all holds"
Table for the three words are at: "Results"

"Results" Table:
ID Results
1 ACTION
2 No Action
3 Urgent

Design view for "Results" table:
Field Name Data Type
ID AutoNumber
Results Long Text

Under the general tab, the Text Format is set to Rich Text. As of now, the ACTION word is in red while the other two words (No Action, Urgent) are in black.

The "Results" list with be used in a combo box in the field "Results / Remarks" in the "all holds" table.

The "all holds" table is set to:
Field Name Data Type
Results / Remarks Short Text

I have a Query for my "all holds" table named "Query and edit all". The general tab's Text Format is set to Rich Text with the lookup tab as follows:

Display Control: Combo Box
Row Source Type: Table/Query
Row Source: Results
Bound Column: 2
Column Count: 2
Column width: 0";1.2"
List rows: 3
List width: 1.2"

I set my "Query and edit all" query thru a macro called "run view all records". My form name is "AQI Main". I select my macro (run view all records) to get into my query (Query and edit all), which grabs the records from the "all holds" table. Once select the "Results / Remarks" field drop list, and choose "ACTION", I get an strange error. The word "ACTION" is not in color but gives an error:

<div><font color=red>ACTION</font></div>

I wondered if there is any place in the user interface (design view, property sheet, etc.) where this can be fixed this? Any help is very much appreciated.

Thank you,
Johnny
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:31
Joined
Oct 29, 2018
Messages
21,453
Hi Johnny. As far as I know, you can only see the color if you use a form. So, I am thinking you may have to create your own pseudo dropdown control by using a [continuous] form.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 20:31
Joined
May 21, 2018
Messages
8,525
<div><font color=red>ACTION</font></div
That is not an error but the Rich text tags viewed in plain text.

If you want different colors on the actual combobox pull down that is not possible. You can fake it with a subform made to look like a combobox.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 20:31
Joined
May 21, 2018
Messages
8,525
DBGuy beat me.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 20:31
Joined
May 21, 2018
Messages
8,525
Here is my fake. I have textbox and a down arrow cmd button pushed together to look like a combobox. Then I have a subform with a rich text field. I shrink and grow this to look like a drop down of a combobox. This fakes a rich text combobox with each row colored different.

Code:
Private WithEvents subfrm As Access.Form
Private subFrmCtl As Access.SubForm

Private Sub cmdDown_Click()
  GrowForm
End Sub

Private Sub Form_Load()
  Set subFrmCtl = Me.subfrmEmployees
  Set subfrm = Me.subfrmEmployees.Form
  subFrmCtl.Height = 0
  subFrmCtl.Visible = False
  subfrm.OnCurrent = "[Event Procedure]"
End Sub
Private Sub subfrm_Exit(Cancel As Integer)
  ShrinkForm
End Sub

Public Sub GrowForm()
  subFrmCtl.Height = 2 * 1440
  subFrmCtl.Visible = True
End Sub

Private Sub ShrinkForm()
  subFrmCtl.Height = 0
  Me.txtName.SetFocus
  subFrmCtl.Visible = False
End Sub
Private Sub subfrm_Current()
   Me.txtName = PlainText(subfrm.RichTextName)
   ShrinkForm
End Sub

Private Sub txtName_KeyDown(KeyCode As Integer, Shift As Integer)
   GrowForm
End Sub

The fake is pretty good, giving the look of a rich text combobox.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 20:31
Joined
May 21, 2018
Messages
8,525
Note the plaintext method where I convert the displayed rich text into plain text to save in my text field.
 

Parrot215

New member
Local time
Yesterday, 17:31
Joined
Oct 24, 2018
Messages
9
Thanks, i was thinking the same thing. It can only be done thru a form. I work with data in a table. Thanks for letting me know.

Johnny
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:31
Joined
Feb 19, 2013
Messages
16,607
you can try using the format property but you would have to base it on just 3 values of -1, 0 and 1

e.g.

"No Action";[Red]"Action";"Urgent"

positive;negative;zero;null
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 20:31
Joined
May 21, 2018
Messages
8,525
FYI, this will format the results, but not the pull down choice. Your original post seemed to suggest you wanted formatting in your pull down.

The no longer supported active X listview could do this, but also was for forms.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:31
Joined
Feb 19, 2013
Messages
16,607
agreed, won't work with dropdown.
 

Parrot215

New member
Local time
Yesterday, 17:31
Joined
Oct 24, 2018
Messages
9
Yeah, one can color the whole data in a table or a certai field (column), but not different texts within a field. Thanks for you help, guys.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 20:31
Joined
May 21, 2018
Messages
8,525
Yeah, one can color the whole data in a table or a certai field (column), but not different texts within a field. Thanks for you help, guys
FYI. No real database developers work directly in a table or query, or allow anyone to work in a table or query. You interface through a form. If you want this capability build a form and fake it as described. If using older versions of Access use a listview.
 

Users who are viewing this thread

Top Bottom