473,799 Members | 3,390 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Searching the data

KK
hello everyone..

i want to search the data in my database word by word. I mean if i put
the something like this in the search textbox "age cellphone date" i
get the list of the every column n row containing the words "age
cellphone date"

is it possible to write such query, plz help me on this and tell me
what things are feasible and if this is not feasible wat are its
alternatives?
Thanks
K
Jun 27 '08 #1
8 1325
KK wrote:
hello everyone..

i want to search the data in my database word by word. I mean if i put
the something like this in the search textbox "age cellphone date" i
get the list of the every column n row containing the words "age
cellphone date"

is it possible to write such query, plz help me on this and tell me
what things are feasible and if this is not feasible wat are its
alternatives?

Thanks
K
If using something beyond A97, this will get you started. Copy this
code into a code module and run it to see the result.

I have a variable called strAndOr. If you passed 3 search words but you
want to see the row if any of the words match, use Or. If all words
must match, use And.

Sub Test()
Dim s() As String
Dim i As Integer
Dim strFilter As String
Dim strFieldName As String
Dim strAndOr As String
Dim intLen As Integer
Dim strSQL As String

'"And" where all words in field to be searched must match
'"Or" for one of the words must match
'Change to "And" or "Or" depending on type of search
strAndOr = "And"

'get the length or And/Or. Used to remove training word
intLen = Len(strAndOr) + 2
'the field name to search. Can be passed as argument
strFieldName = "Address"

'break out the words to search
s = Split("age cellphone date", " ")

'create the filter string
For i = 0 To UBound(s)
strFilter = strFilter & strFieldName & " Like *" & _
s(i) & "* " & strAndOr & " "
Next i

'Create SQL string
strSQL = "Select * From Customer "

'now remove the and/or at end of filter string
If strFilter "" Then strSQL = strSQL & "Where " & _
Left(strFilter, Len(strFilter) - intLen)

'display the SQL if you'd like
MsgBox strSQL

'process however
'...

End Sub

I C U
http://www.youtube.com/watch?v=zb9iDNLtTbE

Jun 27 '08 #2
KK
thks for ur reply

the above code u hv mentioned is in which language? i mean m using JSP
to retrieve data from Access...
Jun 27 '08 #3
Then you should have mentioned this fact in your original post, which in
point of fact needs to be posted in a JSP forum/newsgroup, not in an Access
forum!

The code given is Access/VBA.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200806/1

Jun 27 '08 #4
KK
but JSP is da frontend.. my backend is MS Access and thus i posted my
query here..
Jun 27 '08 #5
On Fri, 20 Jun 2008 16:14:17 -0700 (PDT), KK wrote:
thks for ur reply

the above code u hv mentioned is in which language? i mean m using JSP
to retrieve data from Access...
it is vba, a basic dialect, which is host language for ms-access and other
ms-office products. As a programming person, you do not even have to use
your creative gen to figure out that salad's sequence of assignments just
shows you the sql syntax you are asking for. As you can see, vba is both
clumsy (lacks +=), and overillustrativ e (for i=0 to ..). In some repsect
shorter then pure OO languages like java because af a rich set of statement
and a single global scope. Beeing left in flavor of .net, it lacks modern
paradigms like e.g. iterators and generics that Sun Microsystem with java 6
has blessed us with.
--
Benny Andersen
Jun 27 '08 #6
>but JSP is da frontend.. my backend is MS Access

So the only thing "Access" you're using is the table's data. The front end
is where you're going to have to run your search.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

Jun 27 '08 #7
On Sat, 21 Jun 2008 00:39:40 -0700 (PDT), KK
<Ka************ ****@gmail.comw rote:

You are correct to post here. In your JSP language you need to
construct the SELECT statement:
select * from SomeTable
where SomeField like '*SomeWord*' or SomeField like
'*SomeOtherWord *'
etc.

Then you need to use your language to execute this statement against
the Access database. I've never used JSP but I presume there is a way
to use ADO, and create an ADODB.Recordset object. A JSP-related
newsgroup can help you with the finer points of that.

-Tom.
>but JSP is da frontend.. my backend is MS Access and thus i posted my
query here..
Jun 27 '08 #8
KK wrote:
but JSP is da frontend.. my backend is MS Access and thus i posted my
query here..
I commented my code more than I normally would in this forum because I
figured you were a beginner. I'm surprised that you could not study my
code and determine how to modify it in your java dialect. You might be
better off turning over your project to a programmer.
Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5492
by: sffan | last post by:
I am new to database programming and was curious how others solve the problem of storing encrypted in data in db table columns and then subsequently searching for these records. The particular problem that I am facing is in dealing with (privacy) critical information like credit-card #s and SSNs or business critical information like sales opportunity size or revenue in the database. The requirement is that this data be stored encrypted...
2
6468
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_ { char szInput; char szOutput; int iSum;
2
1127
by: dotNetDave | last post by:
I have implemented custom sorting and searches on my complex objects (they contain properties and collections) using IComparer and BinarySearch. I knew they before doing a search you had to sort your collection, but I found out the hard way yesterday that it has to be sorted on the same property as you are searching on. Fine. But now my problem is that while displaying this collection data to the user I have to search on a different...
33
2518
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following criteria: I have a list of about 100 numbers which correspond to the ID field and also another 40 say numbers corresponding to the numbers in the PRODUCT field. I want to show the rows that correspond to both these criteria.
3
1342
by: ANDY AIYER | last post by:
Guru's! Your time and guidance is much appreciated in this task that i am trying to get done. Background I have a SQL Server 2000 database table which contains 2 Fields (RecordID, XMLData (datatype=TEXT). There are about 10,000 records in this table. The Data in the field (XMLData) is a XML formatted string. (where F1,F2... are
5
2406
by: justobservant | last post by:
When more than one keyword is typed into a search-query, most of the search-results displayed indicate specified keywords scattered throughout an entire website of content i.e., this is shown as three bolded periods '...' in search-result listings. Additionally, most content is outdated; as many users need up-to-date content. Hence, filtering-through search-results becomes quite cumbersome. The newsgroup listings allow detailed...
7
2623
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search string will often not produce a direct match, the results will be based on proximity (50%, 20% 100%, etc). are there any good examples out there on how to do keyword searches on XML data? How should i set up my xml file so
8
1876
by: Allan Ebdrup | last post by:
What would be the fastest way to search 18,000 strings of an average size of 10Kb, I can have all the strings in memory, should I simply do a instr on all of the strings? Or is there a faster way? I would like to have a kind of search like google where you can enter several words to search for, guess that calls for a regular expression "word1|word2|word3|...". Is there any kind of indexing tools available for this kind of thing, I have my...
3
3290
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a "Searching..." page then, refreshes and displays the table I want. I have code that grabs data from the page using cURL but when I look at the data it contains the "Searching..." page and not the table that I want. below is the code i have so far....Thanks...
6
3338
by: bushwacker | last post by:
Hello all, I'm a chemical engineering student. our teacher has given us a project to do some calculations based on some equations. those equations include constants, which are to be read from a file(I don't understand why?) i took an introductory course on c programming but the curriculum didn't include opening files, searching files and getting data from files. i made some searching through google and learned about opening and closing files,...
0
9687
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9543
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10237
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9077
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7567
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6808
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.