473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Search a for a specific keyword in the summary

Hi guys,

Just learnt this 2 days ago. I can't seem to figure out how to proceed.

This is my code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtFindArticleIssue_AfterUpdate()
  2.     Call CheckFilter
  3. End Sub
  4.  
  5. Private Sub txtFindKeyword_AfterUpdate()
  6.     Call CheckFilter
  7. End Sub
  8.  
  9. Private Sub txtFindCreationDate_AfterUpdate()
  10.     Me!txtFindCreationDate = IIf(IsDate(Me!txtFindCreationDate), _
  11.                                  Format(Me!txtFindCreationDate, "d mmm yyyy"), _
  12.                                  "")
  13.     Call CheckFilter
  14. End Sub
  15.  
  16. Private Sub cboFindDomain_AfterUpdate()
  17.     Call CheckFilter
  18. End Sub
  19.  
  20. 'CheckFilter produces the new Filter depending on the values currently in
  21. 'txtFindArticleIssue, txtFindCreationDate, txtFindKeyword & cboFindDomain.
  22. Private Sub CheckFilter()
  23.     Dim strFilter As String, strOldFilter As String
  24.     strOldFilter = Me.Filter
  25.  
  26.     'txtFindArticleIssue - Text
  27.     If Me!txtFindArticleIssue > "" Then _
  28.         strFilter = strFilter & _
  29.                     " AND ([ArticleIssue] Like '" & _
  30.                     Me!txtFindArticleIssue & "*')"
  31.  
  32.     'txtFindCreationDate - Date
  33.     If Me!txtFindCreationDate > "" Then _
  34.         strFilter = strFilter & _
  35.                     " AND ([CreationDate]=" & _
  36.                     Format(CDate(Me!txtFindCreationDate), _
  37.                            "\#m/d/yyyy\#") & ")"
  38.  
  39.     'txtFindKeyword - Text
  40.     ??????
  41.  
  42.     'cboFindDomain - Numeric
  43.     If Me!cboFindDomain > "" Then _
  44.         strFilter = strFilter & _
  45.                     " AND ([Domain]=" & _
  46.                     Me!cboFindDomain & ")"
  47.  
  48.     'Debug.Print ".Filter = '" & strOldFilter & "' - ";
  49.     'Debug.Print "strFilter = '" & strFilter & " '"
  50.     'Tidy up results and apply IF NECESSARY
  51.     If strFilter > "" Then strFilter = Mid(strFilter, 6)
  52.     If strFilter <> strOldFilter Then
  53.         Me.Filter = strFilter
  54.         Me.FilterOn = (strFilter > "")
  55.     End If
  56. End Sub
  57.  
Mar 3 '17 #1

✓ answered by PhilOfWalton

Try this

I have replaced the CheckFilter with CreateFilter so you can delete the former

Phil

9 919
Based on my current code, it only manage to retrieve the first word.

For example, "Apple Banana Cat". If I search for Apple, the record will show. If I search for Cat, there will be no records shown.

Hence, can someone help me modify my code for 'txtFindKeyword - Text
Mar 3 '17 #2
PhilOfWalton
1,430 Expert 1GB
You need wild cards (*) both before and after the text you are searching for

Expand|Select|Wrap|Line Numbers
  1.  strFilter = strFilter & _
  2.                     " AND ([ArticleIssue] Like '*" & _
  3.                     Me!txtFindArticleIssue & "*')"
  4.  
You have currently only got the * after the search string.

Phil
Mar 3 '17 #3
Omg, thanks. It works.

Now I have another question.

For example, I have 3 columns of category.
Is it possible to search for A.I for example, then Top1 and Top2 will be shown?

Or search for Social, then top2 and top3 will be shown?

My current code only let me search for only 1 category.
Expand|Select|Wrap|Line Numbers
  1.  If Me!cboFindDomain > "" Then _
  2.         strFilter = strFilter & _
  3.                     " AND ([Domain]=" & _
  4.                     Me!cboFindDomain & ")"
Title | Category 1 | Category 2 | Category 3
---------------------------------------------------
Top1 | A.I | Drones |
---------------------------------------------------
Top2 | Social | A.I | Engineering
---------------------------------------------------
Top3 | Drones | Space | Social


Thanks in advance
Mar 3 '17 #4
PhilOfWalton
1,430 Expert 1GB
Everything is possible (hopefully)

I need details of your tables and what your form looks like.

Phil
Mar 3 '17 #5
Sure, I have attached my current file. Pls look into it and hopefully you can provide some tips or guide me along.
Attached Files
File Type: zip FSTable.zip (52.5 KB, 41 views)
Mar 3 '17 #6
PhilOfWalton
1,430 Expert 1GB
Sorry andro007, sometimes it's necessary to break things before you fix them and I'm afraid that's just what I've done.

So a few pointers first. I loathe lookup tables, so have created a new table "TblDomains" and removed the lookups in FS_Database table.
I have set up the relationships between these tables.

I strongly advise against spaced in the names of all access objects (forms, queries, tables & reports) and in field names. If you have spaces, you have to surround the field names with square brackets[]

The Combo boxes now show meaningful information.

Also as I am getting on a bit, I can't read 8 point text. I have put it up to 10 point, but personally, providing the form doesn't get too big, I use 12 point.

So now we can get down to your problems. When you are searching for a domain, are you looking for it in any of the 3 domain fields, or specifically in domain1, domain2 or domain3.

Your coding is quite good, but we will modify that when I have answers to the above

Phil
Mar 3 '17 #7
When I am searching for a domain, I am trying to retrieve information from either of the 3 domain fields. As long either of the 3 domain fields contain "Social Media" for example, the record will be shown.


By the way, thanks for your time, appreciated it.

I used to do web programming and python. It's my first time touching on access and vba, so I felt a little lost. I will look at your file and try to understand more.

Cheers! :)
Mar 3 '17 #8
PhilOfWalton
1,430 Expert 1GB
Try this

I have replaced the CheckFilter with CreateFilter so you can delete the former

Phil
Mar 3 '17 #9
Yup, that's what I wanted. It is working great.

Thanks Phil.
Mar 4 '17 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: lfjca | last post by:
Hi everyone, Considering my website is made up of about 100 pages, I have to think of a solution to perform a search (by keyword). The serach result would be a collection of URL/links containing...
1
by: Marc Pichouron | last post by:
Hello, so first of all i would say you that i'm french so sorry for my sitakes. I made an application in XML/XSL which presents the people of my company Let me show the structure of my form : ...
2
by: lfjca | last post by:
Hi everyone, Considering my website is made up of about 100 pages, I have to think of a solution to perform a search (by keyword). The serach result would be a collection of URL/links containing...
8
by: Laser Lu | last post by:
Sometimes, I need to do some time-consuming operations based on whether a specific keyword was contained in a lengthy string. Then, for a better performance, I wrapped that lengthy string into a...
11
by: nickyeng | last post by:
i have a table with some column, one of the column is phone number. so if i want to count the phone number start with 234xxxxxx and 2345xxxxx ...how to do it with sql query statement? like...
1
by: alamodgal | last post by:
hiiiiiii I have a problem in highlighting searching keyword.Actually im using this function for searching Public Function HighLight(ByVal Keyword As String, ByVal ContentFor As String) Dim...
1
by: shoaib kahn | last post by:
i am developing a web site in Asp.Net using Visual Studio 2008. i want to know that how can i search a keyword that will be entered by the user, i want the key word should be searched in complete...
8
by: dannyboy198 | last post by:
Hi all, First, Happy New Year to all :) I am stuck with this problem for my project so I am writing to seek some help regarding this matter. Basically, I am having a form with a search...
14
by: neelsfer | last post by:
I would like to use a combobox and when i add a specific word, it will search for that "word" throughout every record in that specific field of the table. ie 1. Paracetamol 500mg tablets 2. ...
2
by: SKumar365 | last post by:
Hi, I have a database with multiple tables,( Tables are payroll data named as Jan'11, Feb'11 etc up to Dec'11). I would like to have a combo box in the form to show these tables, and a text box to...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.