Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    494

    Unanswered: How to populate "chapter" table fieldname (MSAccess 2000) by selecting book from drop

    I have 2 dropdowns (or listboxes). 1 is for list of books called "book_title". I use a different recordType for value.
    My table
    ID | book_title | recordType | chapter | text_data
    My 2nd dropdown is empty. I don't know what I forgot.
    http://n.1asphost.com/wheelofgod/dropdownduo.asp
    Code:
    <%
    ' Mode contstants
    Const MODE_DEFAULT  = 1
    Const MODE_RESULTS  = 2
    
    Const DB_NAME           = "kjv.mdb"
    Const SCRIPT_NAME       = "kjv.asp"
    Const SCRIPT_TEXTS      = "kjvresp.asp"
    Const SCRIPT_SAVED      = "saved.asp"
    Const SCRIPT_FEEDBACK   = "mailto.asp"
    Const SCRIPT_TEXT       = "bibletext1.asp"
    Const SCRIPT_READ       = "bibletextresp1.asp"
    Const THECHAPTER        = "thechapter.asp"
    
    Const adOpenForwardOnly = 0
    Const adLockReadOnly = 1
    Const adCmdTableDirect = &H0200
    Const adUseClient = 3
    
    Dim nMode   ' Current Mode
    %>
    
    <%
    'Response.Buffer=false
    
    Private Function GetConnectionString()
        GetConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
                    "DBQ=" & Server.MapPath(DB_NAME) & ";" & _
                    "UID=;PWD=;"
    End Function
    Set Conn = server.createobject("ADODB.Connection")
    Conn.open GetConnectionString
        Dim strConn     ' Database connection string
        Dim SQL         ' String that will have our SQL statments
        Dim RS          ' Recordset object
    'query
        Dim iCounter
        Dim iLoopCount
        Dim aRecTypes
        Dim intRec
    
    SQL= "SELECT * FROM bible WHERE "
    
    iCounter = 0
    
    'If   request.QueryString("book_title")="yes" then
    
    '  If iCounter > 0 Then
    '    SQL = SQL & " AND "
    '  End If
    
    '  SQL = SQL & "book_title LIKE '%" & number & "%'"
    
    '  iCounter = iCounter + 1
    
    'end if
    
    If Trim(Request.Form("recordType")) <> "" Then
    
    
      aRecTypes = Split(Request.Form("recordType"), ",")
    
      If IsArray(aRecTypes) Then 'This is a bit redundant, but it can't hurt
    '    SQL = SQL & " ("
    
        For iLoopCount = 0 To UBound(aRecTypes)
    '      If iLoopCount <> 0 Then
    '        SQL = SQL & " OR "
    '      End If
    
          SQL = SQL & "recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
        Next
      End If
    '  SQL = SQL & ")"
    End If
    
    SQL = SQL & " ORDER BY id ASC "
    
    response.write sql
    set RS = Server.CreateObject("ADODB.Recordset")
    
    RS.Open SQL, Conn, adOpenForwardOnly, adLockReadOnly
    %>
    <html>
    <head>
    <META name="keywords" content="bible numerics, bible, numerics, gematria, bible gematria, panin, ivan panin, bullinger, ew bullinger, bible codes, mathematics, statistics, bible science, bible wheel, bible, wheel, God, Jesus, Mohammed, Buddha, Confucius, Jews, Israel, Gilgal, pattern">
    <script language="javascript">
    </script>
    </head>
    
    <body>
    <form name="books" action="dropdownduo.asp" method="post">
             <select id="recordType" size="1" name="recordType" onchange="submit();">
              <option value="" selected>Select a Book</option>
              <option value="gn" name="recordType">Genesis</option>
              <option value="ex" name="recordType">Exodus</option>
              <option value="lv" name="recordType">Leviticus</option>
              <option value="nu" name="recordType">Numbers</option>
              <option value="de" name="recordType">Deuteronomy</option>
              <option value="js" name="recordType">Joshua</option>
              <option value="jg" name="recordType">Judges</option>
              <option value="ru" name="recordType">Ruth</option>
              <option value="sa" name="recordType">1 Samuel</option>
              <option value="sm" name="recordType">2 Samuel</option>
              <option value="ki" name="recordType">1 Kings</option>
              <option value="kn" name="recordType">2 Kings</option>
              <option value="ch" name="recordType">1 Chronicles</option>
              <option value="cr" name="recordType">2 Chronicles</option>
              <option value="ea" name="recordType">Ezra</option>
              <option value="ne" name="recordType">Nehemiah</option>
              <option value="es" name="recordType">Esther</option>
              <option value="jb" name="recordType">Job</option>
              <option value="ps" name="recordType">Psalms</option>
              <option value="pr" name="recordType">Proverbs</option>
              <option value="ec" name="recordType">Ecclesiastes</option>
              <option value="so" name="recordType">Song of Solomon</option>
              <option value="is" name="recordType">Isaiah</option>
              <option value="je" name="recordType">Jeremiah</option>
              <option value="la" name="recordType">Lamentations</option>
              <option value="ez" name="recordType">Ezekiel</option>
              <option value="da" name="recordType">Daniel</option>
              <option value="ho" name="recordType">Hosea</option>
              <option value="jl" name="recordType">Joel</option>
              <option value="am" name="recordType">Amos</option>
              <option value="ob" name="recordType">Obadiah</option>
              <option value="jh" name="recordType">Jonah</option>
              <option value="mi" name="recordType">Micah</option>
              <option value="na" name="recordType">Nahum</option>
              <option value="hb" name="recordType">Habakkuk</option>
              <option value="ze" name="recordType">Zephaniah</option>
              <option value="ha" name="recordType">Haggai</option>
              <option value="zc" name="recordType">Zechariah</option>
              <option value="ml" name="recordType">Malachi</option>
              <option value="mt" name="recordType">Matthew</option>
              <option value="mk" name="recordType">Mark</option>
              <option value="lk" name="recordType">Luke</option>
              <option value="jo" name="recordType">John</option>
              <option value="ac" name="recordType">Acts</option>
              <option value="ro" name="recordType">Romans</option>
              <option value="co" name="recordType">1 Corinthians</option>
              <option value="ci" name="recordType">2 Corinthians</option>
              <option value="ga" name="recordType">Galatians</option>
              <option value="ep" name="recordType">Ephesians</option>
              <option value="ph" name="recordType">Philippians</option>
              <option value="cl" name="recordType">Colossians</option>
              <option value="th" name="recordType">1 Thessalonians</option>
              <option value="te" name="recordType">2 Thessalonians</option>
              <option value="ti" name="recordType">1 Timothy</option>
              <option value="tm" name="recordType">2 Timothy</option>
              <option value="tt" name="recordType">Titus</option>
              <option value="pl" name="recordType">Philemon</option>
              <option value="he" name="recordType">Hebrews</option>
              <option value="ja" name="recordType">James</option>
              <option value="pe" name="recordType">1 Peter</option>
              <option value="pt" name="recordType">2 Peter</option>
              <option value="jn" name="recordType">1 John</option>
              <option value="jnn" name="recordType">2 John</option>
              <option value="jhn" name="recordType">3 John</option>
              <option value="ju" name="recordType">Jude</option>
              <option value="re" name="recordType">Revelation</option>
            </select>
             <select id="chapter" size="1" name="chapter">
              <option value selected>Select a Chapter</option>
    <%Do While Not rs.EOF%>
              <option value="<%=chapter%>"><%=chap%></option>
            <%rs.movenext
             loop%>
            </select>
    
    <%RS.Close()%>
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Jul 2004
    Posts
    494

    3 questions: records not in order, + 2 javascript related

    I decided to change my method for now to make it easierfor myself. I was given a javascript code, in which I had to write down all the chapters in the array. Here it is below. But I had a few questions:

    1. there are some records, which are verses as well and do not appear in their proper order even though the "id" is set in proper order. (Leveticus 6 begins with verse 27 and ends with verse 26
    http://n.1asphost.com/wheelofgod/combo.asp )

    2. The javascript was set for a dropdown trio (three dropdowns). But I want for two drop downs. What do I need to delete?

    3. I would like to set two of the coding below in one page, side by side. I tried it but I think the javascripts, being doubled have errors. Is there a way to get around this problem?
    Code:
    <HTML>
    <HEAD>
    <TITLE>The Bible Online</TITLE>
    <script><!--
    
    arChapters = new Array(50,40,27,36,34,24,21,4,31,24,22,25,29,36,10,13,10,42,150,31,12,8,66,52,5,48,12,14,3,9,1,4,7,3,3,3,2,14,4,28,16,24,21,28,16,16,13,6,6,4,4,5,3,6,4,3,1,13,5,5,3,5,1,1,1,22); // # of chapters in books
    
    
    function loadCombo(cbo, idx) {
     el = null;
     ar = null;
     txt = "";
     
     if(cbo == 1) {
       el = document.f.chapter;
       ar = arChapters;
       txt = "";
     }
     else {
       el = document.f.verse;
       ar = arVerses;
       txt = "Verse ";
     }
     
     while (el.options.length > 0) {
       for(i=0;i<el.options.length;i++) {el.options[i] = null;}
     }
     
     el.options[el.options.length] = new Option(txt + 1);
     for(i=1;i<=ar[idx-1];i++) {
       el.options[el.options.length] = new Option(txt + i);
     }
     
    }
    // -->
    </script>
    </HEAD>
    <BODY>
    
    <form name=f action="thechapter.asp" method="get" target="texta">
    <select name="recordType" id="recordType" onchange="loadCombo(1, this.selectedIndex)">
    <option value="">Select a Book</option>
    <option value="gn" name="recordType">Genesis</option>
              <option value="ex" name="recordType">Exodus</option>
              <option value="lv" name="recordType">Leviticus</option>
              <option value="nu" name="recordType">Numbers</option>
              <option value="de" name="recordType">Deuteronomy</option>
              <option value="js" name="recordType">Joshua</option>
              <option value="jg" name="recordType">Judges</option>
              <option value="ru" name="recordType">Ruth</option>
              <option value="sa" name="recordType">1 Samuel</option>
              <option value="sm" name="recordType">2 Samuel</option>
              <option value="ki" name="recordType">1 Kings</option>
              <option value="kn" name="recordType">2 Kings</option>
              <option value="ch" name="recordType">1 Chronicles</option>
              <option value="cr" name="recordType">2 Chronicles</option>
              <option value="ea" name="recordType">Ezra</option>
              <option value="ne" name="recordType">Nehemiah</option>
              <option value="es" name="recordType">Esther</option>
              <option value="jb" name="recordType">Job</option>
              <option value="ps" name="recordType">Psalms</option>
              <option value="pr" name="recordType">Proverbs</option>
              <option value="ec" name="recordType">Ecclesiastes</option>
              <option value="so" name="recordType">Song of Solomon</option>
              <option value="is" name="recordType">Isaiah</option>
              <option value="je" name="recordType">Jeremiah</option>
              <option value="la" name="recordType">Lamentations</option>
              <option value="ez" name="recordType">Ezekiel</option>
              <option value="da" name="recordType">Daniel</option>
              <option value="ho" name="recordType">Hosea</option>
              <option value="jl" name="recordType">Joel</option>
              <option value="am" name="recordType">Amos</option>
              <option value="ob" name="recordType">Obadiah</option>
              <option value="jh" name="recordType">Jonah</option>
              <option value="mi" name="recordType">Micah</option>
              <option value="na" name="recordType">Nahum</option>
              <option value="hb" name="recordType">Habakkuk</option>
              <option value="ze" name="recordType">Zephaniah</option>
              <option value="ha" name="recordType">Haggai</option>
              <option value="zc" name="recordType">Zechariah</option>
              <option value="ml" name="recordType">Malachi</option>
              <option value="mt" name="recordType">Matthew</option>
              <option value="mk" name="recordType">Mark</option>
              <option value="lk" name="recordType">Luke</option>
              <option value="jo" name="recordType">John</option>
              <option value="ac" name="recordType">Acts</option>
              <option value="ro" name="recordType">Romans</option>
              <option value="co" name="recordType">1 Corinthians</option>
              <option value="ci" name="recordType">2 Corinthians</option>
              <option value="ga" name="recordType">Galatians</option>
              <option value="ep" name="recordType">Ephesians</option>
              <option value="ph" name="recordType">Philippians</option>
              <option value="cl" name="recordType">Colossians</option>
              <option value="th" name="recordType">1 Thessalonians</option>
              <option value="te" name="recordType">2 Thessalonians</option>
              <option value="ti" name="recordType">1 Timothy</option>
              <option value="tm" name="recordType">2 Timothy</option>
              <option value="tt" name="recordType">Titus</option>
              <option value="pl" name="recordType">Philemon</option>
              <option value="he" name="recordType">Hebrews</option>
              <option value="ja" name="recordType">James</option>
              <option value="pe" name="recordType">1 Peter</option>
              <option value="pt" name="recordType">2 Peter</option>
              <option value="jn" name="recordType">1 John</option>
              <option value="jnn" name="recordType">2 John</option>
              <option value="jhn" name="recordType">3 John</option>
              <option value="ju" name="recordType">Jude</option>
              <option value="re" name="recordType">Revelation</option>
    </select>
    
    <select name="chapter">
    <option value="">Select a Chapter</option>
    <%'<option value=1>Chapter 1</option>
    '<option value=1>Chapter 2</option>
    '<option value=1>Chapter 3</option>%>
    </select>
    <input type="checkbox" name="passage" value="passage">Show Passages Above Verses
    <input id="recordType" type="submit" value=" Search "> <input type="reset" value="Clear" name="B2">
    </form>
            <iframe name="texta" style="width:200px;height:500px"></iframe>
    </BODY>
    </HTML>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •