?
Solved

How to search for phrases in Bible Access database

Posted on 2004-09-06
8
Medium Priority
?
779 Views
Last Modified: 2013-12-25
I have the entire Bible stored in an Access database.  The name of the Bible books are store in text fields. The verses are stored in memo fields.  How can I quickly search all the verses for phrases and load that verse in the a richtextbox if it matches the query?

I was attempting to use the data control.
0
Comment
Question by:mcdonald_g
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 7

Expert Comment

by:SQL_Stu
ID: 11990135
You could use the INSTR function.

For example:

if INSTR(1, verses.text, "garden") > 0 Then

the above searches the text field within the verses table for the word "garden".  If it is found, it returns the position of the word in the text.

0
 
LVL 32

Expert Comment

by:jadedata
ID: 11990211
Greetings mcdonald_g! and Experts

 This is a duplicate question.  Answers are also being taken on http:Q_21120467.html
 mcdonald_g:  Please request a delete of this question in Community Support ("Support" at the top of the page)

regards
:)-j-
0
 
LVL 32

Expert Comment

by:jadedata
ID: 11990226
A quick re-read shows that the question are not exact duplicates.  

mcdonald_g:  You could probably have combined the questions considering they both relate to searching a specific table in your db project.

just a thought.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 18

Expert Comment

by:JR2003
ID: 11992678
You can use the like operator in SQL to filter the results to only records containing a certain verse:

e.g.
 
SELECT TableVerses.*
FROM TableVerses
WHERE TableVerses.VerseText Like '*on the first day*';

0
 

Author Comment

by:mcdonald_g
ID: 11993716
JR2003, can you provide all DB code for a data control do I can cut and paste?
0
 

Accepted Solution

by:
ysagada1012 earned 1500 total points
ID: 11994373
JR2003,

All you have to do is save the result of the query in a recordset then transfer all its contents to your richtextbox.

i.e.

dim txtsql as string
dim txtverse as string
txtsql=SELECT Verse
FROM TableVerses
WHERE VerseText Like '*on the first day*';

rs=cn.open (txtsql)

while not rs.eof
txtverse = txtverse & rs.fields(0).value
rs.movenext
wend


0
 
LVL 18

Expert Comment

by:JR2003
ID: 11994478
A little more complete:
You will need to have a reference to "Microsoft ActiveX Data Objects 2.x Library" from the Project/References menu option.


Somewhere in a module you will have a conection object defined like this that will be connected to you database when you start your application, defined like this "Public g_MyDb As ADODB.Connection"


    Dim MySet As ADODB.Recordset
    Dim sSql As String
   
     
    sSql = "SELECT TableVerses.* "
    sSql = sSql & "FROM TableVerses "
    sSql = sSql & "WHERE TableVerses.VerseText Like '*on the first day*'"

    Set MySet = New ADODB.Recordset
       
    With MySet
        .Open sSql, g_MyDb
        While Not .EOF
            RichTextBox1.Text = RichTextBox1.Text & !VerseText
            'Add record processing code here
            .MoveNext
        Wend
        .Close
    End With
    Set MySet = Nothing


0
 

Expert Comment

by:DarrelW
ID: 23565987
I have a similar case, but the verses are stored in RTF-encoded format. I can read the data as text, but it will not recognize the RTF codes, so I think I am pulling the data from Access as text rather than rtf.

I connect fine to the Access db. I can read any straight text verses fine, only bombs when reading RTF.

Can you help me?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question