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

Find a key word based on a list of characters(sentence)

Is it possible to search for a particular word in a string of words
For Eg

I am Crazy :))
Its a Crazy world
It is a lovely day.

If I input Crazy in a form, It should list the first 2 sentence.
Could anyone give me a code to achieve this?
Thanks in Advance
Jan 20 '10 #1
4 2360
Delerna
1,134 Expert 1GB
One way is something like

Expand|Select|Wrap|Line Numbers
  1. SELECT WordStringField 
  2. FROM TheTable
  3. WHERE WordStringField like "%" & Forms!YourForm.SearchTextbox & "%"
  4.  
I haven't tested that so you might need to adjust the syntax.
You will definitely need to adjust the names to suit your own.
Put it into a query and put a button on the form that opens the query.
Or some other method of getting the result.
Jan 20 '10 #2
Hi,
Thanks for getting back to me.
I have a AuthorsDatabase with Fields AuthorName and Quotes(Text Field)
I created a Form Called QiuoteSelectionQ
with a Outbound Field Called QuoteQ where I will input the word

I have a list box called KeywordSelection
with the Query SELECT Quotes FROM AuthorsDatabase WHERE Quotes like "%" & Forms!QuoteSelectionQ.QuoteQ & "%";

It does not work . Please Help
Jan 20 '10 #3
Delerna
1,134 Expert 1GB
I will try and put together a mock up of what you are doing and Post something more specific for you later.

In the meantime...something for you to consider
Maybe you can find the answer before I post back.
You will gain the most experience for yourself if you can.


Where have you put the query?
You input something into QuoteQ...Then what?
What I mean by that is
How are you causing the query to execute after something new gets entered?

Do you have VBA code in the after update event or the key down event or some other event, of the QuoteQ textbox, that takes note that a new search text has been entered so I had better refresh the list box?


I would suggest that you
1) create a query using the sql.
....That way you can test the query by itself and adjust it until it works.
....If you open the query without the form being open then the query
....will ask you to supply the parameter via an input box.
....Once the query itself is working then
2) Put a button on your form that opens the query.
....Run the form enter something into the textbox and click the button
....That way you can test that the query is bound to the textbox correctly.
....Once that is working then
3) Either bind your Listbox to the query
....or paste the SQL from the query into the source property of the list box.
....Now all you need to do is cause the listbox to refresh itself at the appropriate time. Probably something like Me.Requery or Me.Refresh in the after update event of the QuoteQ textbox


You should, as a Newbie, always build up the workings of your forms in a progressive way, as described. Too many changes at the same time can become confusing to debug when it doesn't work.

I still, as a so called "expert", still break something that doesn't work down into simpler steps and progressively build it up into what I need. Its just easier to discover where something is going wrong when you do that. Of course, as you gain experience you need to do that less and less and the simple can become more and more complex.
Jan 20 '10 #4
Delerna
1,134 Expert 1GB
Actually I have just discovered the first thing
In the query, the % should be *.

I write SQL both in "MS access" and "MS SQL Server" but mostly "MS SQL Server"
SQL sytax varies slightly between those two database apps and I gave you the SQLSever syntax.

My bad, and I appologies for that.
Jan 20 '10 #5

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

Similar topics

1
by: smith flyers | last post by:
i got the following error when compiling the codes.. the name 'word' does not exist in the class or namespace 'SimpleMath.Pig' Can anyone troubleshoot on this . Thank you ...
1
by: Iwan Petrow | last post by:
Hi, I want to count words in a string which are NOT with length 10. For me word is a sequence of symbols different from ' '. So I want to match these words. I think that the pattern has to be...
9
by: Steven Bethard | last post by:
I've got a list of word substrings (the "tokens") which I need to align to a string of text (the "sentence"). The sentence is basically the concatenation of the token list, with spaces sometimes...
10
by: Sidhu | last post by:
Hoe to relplace the word in sentence? Can any one send program?
1
by: iElf | last post by:
can someone point out my error? cus this is printing out garbage and not the longest word... Program ( I underlined the loop Im trying to make to read and find the longest word) everything else...
2
by: BlackEyesBlueTears | last post by:
i've been asked to write a program to find the number of times that a given word occurs in a sentence.sentence and the word both are to be take as input from the user. for example: EnTER A...
0
by: alivip | last post by:
I write code to get most frequent words in the file I won't to implement bigram probability by modifying the code to do the following: How can I get every Token (word) and ...
5
by: alivip | last post by:
How can I get every Token (word) and PreviousToken(Previous word) From multube files and frequency of each two word my code is trying to get all single word and double word (every Token (word) and...
3
by: bstjean | last post by:
Hi everyone, I am trying to find an efficient way to perform a special query. Let me explain what I want. Let's say we are looking for all description that match "this is the target". In...
12
by: jackson.rayne | last post by:
Hello, I am a javascript newbie and I'm stick at one place. I have a requirement where I will get a sentence in a variable example var v1 ="This is a sentence"
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
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?
0
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,...
0
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
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
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...

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.