473,322 Members | 1,911 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,322 software developers and data experts.

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 1306
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.com
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 overillustrative (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.comwrote:

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
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...
2
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_...
2
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...
33
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...
3
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...
5
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...
7
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...
8
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?...
3
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...
6
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.