Solved

How to search for phrases in Bible Access database

Posted on 2004-09-06
8
740 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
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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now