Solved Highlight Matching keywords with red Color. (1 Viewer)

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
Hello, I have a Search Form and two search textboxes.
I want to two textboxes keyword search Highlighting in this subform with red Color.

my Subform is not Query or SQL. It has an expression into Control Source.
any help be appreciated.
 

arnelgp

error reading drive A:
Local time
Today, 17:47
Joined
May 7, 2009
Messages
12,851
can you use Conditional Format?
 

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
can you use Conditional Format?
Thanks arnel. Can't use conditional format. because this is an expression ref to display not data type.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:47
Joined
Feb 19, 2013
Messages
13,011
my Subform is not Query or SQL. It has an expression into Control Source.
subforms do not have controlsources, they have sourceobject. Do you mean a listbox?
 

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
subforms do not have controlsources, they have sourceobject. Do you mean a listbox?


subform textbox Control Sources :
Code:
=([cName] & " " & "◄►" & " " & "Hex #:" & " " & [hex] & " " & "◄►" & " " & "RGB" & " " & "[" & "R=" & [R] & " " & "G=" & [G] & " " & "B=" & [B] & "]" & " " & "◄►" & " " & "MS Access #:" & " " & [a])

Form SQL like that:
Code:
SELECT Colors.ID, Colors.cName, Colors.hex, Colors.cInitial, Colors.R, Colors.G, Colors.B, Colors.A
FROM Colors
ORDER BY Colors.cName;
 

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
Here output is one color via 4 Method,
I doubt that I don't explain you's guy as well, so, I upload this db.
 

Attachments

  • Color.accdb
    548 KB · Views: 49

arnelgp

error reading drive A:
Local time
Today, 17:47
Joined
May 7, 2009
Messages
12,851
I only add Conditional Format to ColorName
 

Attachments

  • Color.zip
    77.8 KB · Views: 47

CJ_London

Super Moderator
Staff member
Local time
Today, 10:47
Joined
Feb 19, 2013
Messages
13,011
if you put your formula into your subform recordsource you can use richtext to highlight the search text. See attached - not I have disabled most of your code to demonstrate the principle.
 

Attachments

  • Color (1).accdb
    640 KB · Views: 43

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
if you put your formula into your subform recordsource you can use richtext to highlight the search text. See attached - not I have disabled most of your code to demonstrate the principle.

Thank you so much for help. Exactly I wanting like that, but it not shake when Type data, I put it ON CHANGE event but not being good result. and you see also HEX search box not work. I try to requery but not success.
if more help would be greatly appreciated.
 

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
I only add Conditional Format to ColorName
Thanks for help, I appreciate.
I apologize to say, I wanting letter will be RED color when searching. But your suggestion also good and colorful. Thanks again.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:47
Joined
Feb 19, 2013
Messages
13,011
it is just an example since it is not clear to me the real requirement - you will need to modify code to include Hex - or you could just put a hex value in the search text box and change the label caption to something like 'Search'
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:47
Joined
Feb 19, 2013
Messages
13,011
if you want to use the change event, in the query you need to reference the .text property of the control
 

arnelgp

error reading drive A:
Local time
Today, 17:47
Joined
May 7, 2009
Messages
12,851
see FrmSearch2 and the code behind.
i added another field DisplayText, the content
of which is the Original display of the textbox on subform.
you cannot highlight it since it is continuous form and
the Textbox need to be Bound.

theres a lot of code just to have a makeup.
 

Attachments

  • Color.zip
    52.4 KB · Views: 41

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
see FrmSearch2 and the code behind.
i added another field DisplayText, the content
of which is the Original display of the textbox on subform.
you cannot highlight it since it is continuous form and
the Textbox need to be Bound.

theres a lot of code just to have a makeup.
Thanks you so much arnelgp . its great looking now. I see On_Change Event in your code. But why data not sorting when I typing search boxes. Can you check it again please.
If not sorting, dont have benefit, Bcoz there have 200+ rows.
 

arnelgp

error reading drive A:
Local time
Today, 17:47
Joined
May 7, 2009
Messages
12,851
check if this will sort.
 

Attachments

  • Color.zip
    68.7 KB · Views: 37

smtazulislam

Member
Local time
Today, 12:47
Joined
Mar 27, 2020
Messages
426
check if this will sort.
No work.
I meant, when I typing in the search boxes then subform data will be sorting which data has matched, if not match subform will blank. but here not changing subform data.
 

arnelgp

error reading drive A:
Local time
Today, 17:47
Joined
May 7, 2009
Messages
12,851
I thought you only wanted to Sort.
test again.
 

Attachments

  • Color.zip
    86.7 KB · Views: 45

Users who are viewing this thread

Top Bottom