• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 456
  • Last Modified:

How to load specific records from Bible database

I have the entire Bible stored in an access database.  The name of the Bible books are stored in text fields.  The chapter numbers of the bible books are stored in integer fields.

My question is how can I load and display specific books/chapters using queries?

Example: How can I load only verses in Genesis, Chapter 5, verse 2  ?

I was attempting to use the data control but could not figure out a solution.
0
mcdonald_g
Asked:
mcdonald_g
  • 6
  • 4
1 Solution
 
mladenoviczCommented:
You will have to provide informaion about database definition (tables, field names) if you want somebody to help you with query
0
 
mcdonald_gAuthor Commented:
The database structure is as follows:
Table = Bible
Field 1 = Books (Text format) 'This is the name of each book of the Bible
Field 2 = Chapters (Integer format) 'This is the Chapter numbers
Field 3 = Verse (Integer format) ' This is the verse numbers
Field 4 =  Text (Memo format) 'This stored the text of each verse in the Bible
0
 
SQL_StuCommented:
You'll need an SQL query something like:

select field4 from bible
where field3 = 2
and field2 = 5
and field1 = "genesis"
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mladenoviczCommented:
SELECT * FROM Bible WHERE Books='Genesis' AND Chapters=5 AND Verse=2
0
 
mcdonald_gAuthor Commented:
mladenovicz, how do I use that query in code?  Is it useful with the data control?
0
 
mladenoviczCommented:
Something like this:

Public Function Test()

Dim adoRS   As ADODB.Recordset
Dim adoConn As ADODB.Connection
Dim sDNS    As String
   
    Set adoRS = New ADODB.Recordset
    adoRS.CursorLocation = adUseClient
       
    sDNS = YourConnectionString '--> set according your settings

    Qry = "SELECT * FROM Bible WHERE Books='Genesis' AND Chapters=5 AND Verse=2"

    Set adoConn = New ADODB.Connection
    adoConn.Open sDSN
    adoRS.Open Qry, adoConn, adOpenStatic, adLockBatchOptimistic

    If Not (adoRS.BOF And adoRS.EOF) Then Msgbox adoRS("Text")
       
    ' clean up
    adoRS.Close
    Set adoRS = Nothing
    adoConn.Close
    Set adoConn = Nothing
   
End Function

You will need reference to the Microsoft ADO.

You can use this with data control. You should set RecordSource to this query string. Before that, you should fill Databse property
0
 
mcdonald_gAuthor Commented:
mladenovicz, can you help me out one more time. I'm going to give you the points.
I tried the query in the data control and it didn't work.

what should the sDNS connnection string be?  The name of my database is "KJV.mdb", and the table is "Bible"
0
 
mladenoviczCommented:
What is the full path of KJV.mdb file (e.g. "C:\My Documents\KJV.mdb")?
0
 
mladenoviczCommented:
Try sthg like this (put Data control on form and put textbox)

Private Sub Form_Load()
    Data1.DatabaseName = "C:\db1.mdb"
    Data1.RecordsetType = 1
    Data1.RecordSource = "SELECT * FROM Bible"
    Data1.RecordSource = "SELECT * FROM Bible WHERE Books='Genesis' AND Chapters=5 AND Verse=2"

    Set Text1.DataSource = Data1.Recordset
    Text1.DataField = "Text"
End Sub
0
 
mladenoviczCommented:
You have to replace "C:\db1.mdb" with your dataabse path
0
 
mcdonald_gAuthor Commented:
Hey, I think I may have given too many points for this question.   I thought the solution would me much harder than this.  Congrats mladenovicz!  Thanks for your help as I'm almost done with my Bible project.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now