I have a continuous form with 4 phone fields on it (Let's call them Phone1 ... Phone 4) (They are text fields)
I have a textbox (TxtPhoneFilter) in the form footer where I enter part of the phone number.
On the OnChange of TxtPhoneFilter, I build a filter something like -
Sub TxtPhoneFilter_Change()
-
-
Dim PhoneFltr As String
-
-
' If we return no records, tempotarily remove the filter
-
If Me.RecordsetClone.RecordCount = 0 Then
-
Me.FilterOn = False
-
End If
-
-
If Nz(TxtPhoneFilter) = "" Then
-
Me.FilterOn = False
-
End If
-
-
TxtPhoneFilter.SetFocus
-
-
If PhoneFltr > "" Then ' Media Type selected
-
PhoneFltr = PhoneFltr & ") OR "
-
End If
-
PhoneFltr = PhoneFltr & "(sPhone1 Like '*" & Replace(Me.TxtPhoneFilter.Text, "'", "''") & "*'"
-
If PhoneFltr > "" Then ' Media Type selected
-
PhoneFltr = PhoneFltr & ") OR "
-
End If
-
PhoneFltr = PhoneFltr & "(Phone2 Like '*" & Replace(Me.TxtPhoneFilter.Text, "'", "''") & "*'"
-
If PhoneFltr > "" Then ' Media Type selected
-
PhoneFltr = PhoneFltr & ") OR "
-
End If
-
PhoneFltr = PhoneFltr & "(Phone3 Like '*" & Replace(Me.TxtPhoneFilter.Text, "'", "''") & "*'"
-
If PhoneFltr > "" Then ' Media Type selected
-
PhoneFltr = PhoneFltr & ") OR "
-
End If
-
PhoneFltr = PhoneFltr & "(Phone4 Like '*" & Replace(Me.TxtPhoneFilter.Text, "'", "''") & "*'"
-
PhoneFltr = PhoneFltr & ")"
-
-
Me.Form.Filter = PhoneFltr
-
Me.FilterOn = True
-
-
Me.TxtPhoneFilter.SetFocus
-
-
' Move the cursor to the end of the input text box.
-
If Me.RecordsetClone.RecordCount = 0 Then
-
Exit Sub
-
End If
-
-
Me.TxtPhoneFilter.SelStart = Len(Me.TxtPhoneFilter.Text)
-
This woks very sweetly and progressively filters the form, showing fewer and fewer records as more letters (digits) of the phone number are entered into TxtPhoneFilter.
So suppose we are down to 6 records = 24 phone numbers.
Now what I want to do is to highlight only those phone numbers that match TxtPhoneFilter.
Stymied. Any ideas please?
Phil
5 1393
Sorry, I withdraw the question. Solved it
Phil
zmbd 5,501
Expert Mod 4TB
You could share how.... :)
Personally, I would look at the potential of conditional formatting or even add the formatting to your existing code...
There's a nice little blog here that walks thru creating and adding the formatting conditions by VBA https://blogs.msdn.microsoft.com/fri...cess-with-vba/
:)
What give away my trade secrets ... alright then.
I created 4 text boxes with the control source like this
IsPhone1 ControlSource -
=IIf(Nz([TxtPhoneFilter])>"",IIf([Phone1] Like "*" & [TxtPhoneFilter] & "*",True,False),False)
-
Then conditional formatting like this
Expression is IsPhone1 True then the alternative format.
Works a treat.
Phil
Sounds like you go it. I was working on something like this recently, so I mocked up a DB for ya and attached it anyway.
It uses RichText formatted TextBoxes which allows for some creative coloring.
Yes that' very neat. The main difference obviously is that you are highlighting individual figures whilst I am highlighting the whole phone number.
Anyway your Db now sits in my sample Db folder were I have loads of bits and pieces for reference for a rainy day..
Thanks again
Phil
Sign in to post your reply or Sign up for a free account.
Similar topics
by: leegold2 |
last post by:
I've seen previous threads but I still need help in highlighting
search terms like google does on their search result page.
I know I need, ob_start();
Then I process to highlight the search term...
|
by: Mario |
last post by:
I am trying to set up a search field that searches my only my website.
I dont want to link it to other search engines. It is only for the web im
developing.
Any Links or Suggestions on how to...
|
by: Captain Wonky |
last post by:
As the subject says... I'm a database novice even though I've been
trying to learn Access for years. I've 'almost finished' several
databases but always get stumped on something - this time it's...
|
by: Raterus |
last post by:
Does anyone know of some code samples that will parse a string field into an array of strings, but do it like a search engine would. I'm sure this would be fun to do it myself, but if an algorithm...
|
by: AA Arens |
last post by:
When I push on my find-record button, after I focussed on the ID-number
field on my form, the default search field in the Search-form dialog
menu is not the focussed field, but another.
Why?
...
|
by: Jon |
last post by:
If anyone can help...Whenevr I go into a form and use the ctrl+F to
find something with the binoculars the "Search field as formatted" is
checked as default. This seems to slow down the find...
|
by: mmarif4u |
last post by:
Hi everyone,
I have a little problem in php coding.
i have mysql table guestbook:
Fields are Id,name,email,comment,datetime.
Now i want to search the database by php query using
a Dropdown menu...
|
by: ZEROFIVE |
last post by:
Just wanted to know how would i go about making a Search field and search results page if someone wanted to search on my site?
Thanks alot,
Jimmy
|
by: brenty66 |
last post by:
I have a userform that is used as an interface for information stored on excel spreadsheets. The user enters bits of information into fields on the userform which are place on the corresponding...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |