Cmbchapter_Click
Return

Resume : - (Private Sub Cmbchapter_Click()).

When you select an item in the ComboBox - Cmbchapter:

  • In the current string of this ComboBox displays the chapter order of the book corresponding to the item displays in the current string of the ComboBox - Cmbbook .
  • The index of the currently item selected =
    The index of the item displays in the current string of the
    ComboBox - Cmbchapterrecno.
  • In the current string of the ComboBox - Cmbchapterrecno displays the order of the KJV database record corresponding to the item selected.
  • Search operation:
  • The ComboBox - Cmbverse stores all verses orders of this chapter and in the current string displays the 1st verse order.
  • The ComboBox - Cmbverserecno stores the orders of the KJV database records corresponding to the items stored in the ComboBox - Cmbverse.
  • Into the Record data boxes displays the record correspondig to the currently item of the ComboBox - Cmbchapterrecno.

    Note:

    The record includes the following data:
    the order and title of the book display in the comboboxes - Cmbbook and Cmbtitle,
    the item selected,
    the 1st verse order of the chapter,
    and the contents of the 1st verse of the chapter.
  • Details ...

    1. Sub Cmbchapter_Click, .procedure:

      1. Algorithm ...


      2. Examine the Code - the new text Code to be add is red.

        when you click an item of the CombBox - Cmbchapter,
        Private Sub Cmbchapter_Click()
        'AdRecordset1 - RecordSet object
        Dim db1 As Connection
        Set db1 = New Connection
        db1.CursorLocation = adUseClient
        db1.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & strdatasource
        
        Set AdRecordset1 = New Recordset
        AdRecordset1.Open "select Book,BookTitle,Chapter,Verse from BibleTable", db1, adOpenStatic, adLockOptimistic
        
        If Cmbchapter.Enabled = True Then
        Setchapter False
        
        adoPrimaryRS.MoveFirst
        Cmbchapterrecno.ListIndex = Cmbchapter.ListIndex
        'Record number
        recordno = Val(Trim(Cmbchapterrecno.Text))
        
        Cmbverse.Clear
        Cmbverserecno.Clear
        
        ' The Cmbverse stores all verses orders of the chapter corresponding to the item selected.
        ' The Cmbverserecno stores the orders of the KJV records corresponding to the items of Cmbverse
        
        With AdRecordset1
        	.MoveFirst
        	.Move (recordno)
        	
        	'verse values
        	Cmbverse.AddItem Trim(.Fields(3).Value)
        	Cmbverserecno.AddItem Str(Val(.AbsolutePosition) - 1)
        	
        	Do While Not .EOF
        		If Trim(.Fields(1).Value) = Trim(Cmbtitle.Text) And _
        			Trim(.Fields(2).Value) = Trim(Cmbchapter) Then
        			
        			Cmbverse.AddItem Trim(.Fields(3).Value)
        			Cmbverserecno.AddItem Str(Val(.AbsolutePosition) - 1)
        		Else
        			'1- The record displays into the Record data boxes, includes the following data:
        			' the order and title of the book display in the Cmbbook and Cmbtitle,
        			' the item selected,
        			' the 1st verse order of the chapter
        			' and the contents of the verse.
        			'2- In the Cmbchapter, displays the item selected
        			'3- In the Cmbverse, displays the 1st verse order of the chapter
        			
        			Cmbverse.ListIndex = 0
        			Cmbverserecno.ListIndex = Cmbverse.ListIndex
        			        adoPrimaryRS.Move (recordno)
        			Call LabelAddress
        			Setchapter True
        			If Cmbverserecno.Text = 2 Then
        				CmdFirst.Enabled = False
        				CmdPrevious.Enabled = False
        			End If
        			Exit Sub
        		End If
        		.MoveNext
        	Loop
        End With
        
        
        End If
        
        End Sub
    2. Save this application; From File menu, choose and click Save Project.
    3. Run it; From Run menu, choose and click Start.
    4. If all testing work probably, the operation is completed.
    5. The CD-Rom - TeachVB stores the analogue application in the folder \\Projects VB\Test VB8c.
      If you want to run it:
      1. Copy the folder Test VB8c from the CD-Rom - TeachVB onto C: drive.
      2. Remove the read-only attribute of all files in the folder C:\Test VB8c.
      3. Run the Microsoft Visual Basic 6.0.
      4. From File menu, choose Open Project, Visual Basic displays the Open Project dialog box, click the Existing tab, select the TestVB0 project file (C:\Test VB8c\TestVB0.vbp) and then click Open.
      5. From Run menu , choose and click Start.
    Return