Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Data from Description Field

Status
Not open for further replies.

davidchipman

Programmer
Jun 27, 2002
19
CA
Hello All,
I have a description field in a database that I'm working on. It is a field with a description of criteria used to create certain queries. What I need to do run a script or query that will loop through each record and create a list of unique words that appear in the field and then assign a count to each word. So the word Income for instance was in the field 500 times.

Anybody have any ideas?

Thanks in Advance.
 
HI

Not sure which bits you do not understand

ie

A) is you problem how to loop through the records in the table?

B) how to loop through the column 'Description' looking for words

C)how to count the occurrences

A) is a simple loop, in DAO it would be

Dim Db as DAtabase
Dim RS as REcordset
Set Db = CurrentDb()
Set RS = Db.OPenREcordset("SELECT Description FROM MyTAble;")
If RS.REcordCount > 0 THen
Do until Rs.EOF
' do you stuff here
rs.movenext
Loop

B) To seach for words use Instr() to look for the spaces seperating the words, and left(), MId(), Right() to 'copy' them out of the string, if you do this in aloop so

Dim I as Integer
For i = 1 To Len(Rs!Description)
' code here to find words
Next i

C) I would do this by having a table with two columns "Word" and "WordCount"

within the loop described in B above attempt to find the word in the table with a simple SQL string, if found, add 1 to the WOrdcount, if not found, then create a record with wordcount of 1

Is that what you want to know?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top