Solved

How to search for phrases in Bible Access database

Posted on 2004-09-06
8
775 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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 375 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

Technology Partners: 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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

737 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