473,487 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Creating a Keyword Search that filters records in a form

112 New Member
Hi All this is my first time post, be gentle.

I am looking at creating a keyword search that searches multiple fields in a Form and then filters records that match the keyword. The Form currently has a button that connects to a Query that run the keyword search in several field and then filters the results. The problem is that I can not do a search within a search, or have multiple words searched in any order. For example there are 20,000 records, I click the button and a Pop Up Box asks me to enter a keyword. I type "blue" as my keyword and it filters me down to 1,000 records. If I want to narrow it down farther I can't because if I click the button again it starts the search from my original 20,000 records. So I either need to be able to search for "blue" then re-search my filter records by "green" or to be able to search for "blue and green" in any order over the multiple fields. I have seen several codes posted in other posts that have elements of what I want this to do but I do not know enough about VB code to put it all together. None of them involved using a Query to do the search like I describe above (Which was built by my predecessor). I do not care if it is run off a Button that opens a Message Box or if it is linked to a Text box in the Footer Bar that you just type the keyword into and hit enter. I also do not care if it is built into a Query or just VB code. Also if the keyword in each record could be highlighted when it has filter the records that would be great as some of the fields are memo and there is a lot of text to look at the find the keyword.

Thanks
Oct 3 '07 #1
3 5378
nico5038
3,080 Recognized Expert Specialist
Can you post the code the button is using ?

Nic;o)
Oct 6 '07 #2
Redbeard
112 New Member
Sure here is the code for the Keyword search button.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Keyword_Search_Click()
  2. On Error GoTo Err_Keyword_Search_Click
  3.  
  4.     Dim stLinkCriteria As String
  5.  
  6.     DoCmd.Close acForm, "frmDescription"
  7.     DoCmd.OpenForm "frmDescription", , "qryKeyword3", stLinkCriteria
  8.  
  9.  
  10. Exit_Keyword_Search_Click:
  11.     Exit Sub
  12.  
  13. Err_Keyword_Search_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_Keyword_Search_Click
  16.  
  17. End Sub
Oct 9 '07 #3
nico5038
3,080 Recognized Expert Specialist
The query obviously holds a variable for filtering the records, causing the popup asking you the (single) value.
For multiple values you would need to have multiple fields on the form and construct a strCriteria with the entered values.

An easy solution is to use the right-click popup to perform the filtering for single selections or for multiple "AND" related selections, see my userinstruction for this at:
http://www.geocities.com/nico5038/xR...nstruction.zip
When you need an "OR" relation, then you can use the "Filter by Form" option allowing you to fill multiple "OR" tabs (see left bottom corner).

When you want to use the strCriteria filtering and start coding, then let me know.

Nic;o)
Oct 9 '07 #4

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

Similar topics

2
5949
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks...
5
2784
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that worked in ACC97 doesn't work in ACC2K2. Report setup: ACC97 ...
1
2897
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
2
3980
by: TD | last post by:
I have a main form with a subform. On the main form is a button to apply/unapply a filter to show only certain records. On the main form is another button thats opens a form that shows the details...
2
431
by: Ray Todd Jr | last post by:
I have created a 9 table database. I am wanting have also created a search form so that I can obviously search for the various records in the database. I am however having a problem to which I...
1
1591
by: Jimmy | last post by:
I have two questions regarding using filters. One: I would like to be able to filter the records, displayed in a form based on several criteria using checkboxes or option buttons. The table has...
1
3127
by: prasath03 | last post by:
Hi Gurus, I am doing one website project that project contains one search module. In that search page i have entered the keyword to search. If i want to search the keyword with "any keyword" or...
31
2604
by: Redbeard | last post by:
I have a keyword search button on my databases footer bar which when clicked opens a pop-up box that you can type a key word into. When the keyword is entered it put it into a query that filters my...
4
3637
by: stateemk | last post by:
I have a table that has about 300 records in it. The table references word documents that are procedures. So, the table has a column for document description, procedure number, type and word...
0
6967
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...
0
7142
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,...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7352
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
5445
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,...
1
4875
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...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.