Cmbtitle_Click
Return

Resume : - (Private Sub Cmbtitle_Click).

When you select an item in the
ComboBox - Cmbtitle:

  • In the current string of this ComboBox displays the titre of the book.
  • The index of the currently item selected =
    The index of the item displays in the current string of the
    ComboBox - Cmbtitlerecno =
    The index of the item displays in the current string of the
    ComboBox - Cmbbook.
  • In the current string of the ComboBox - Cmbtitlerecno displays the order of the KJV database record corresponding to the item selected.
  • In the current string of the ComboBox - Cmbbook displays the order of the book.
  • Search operation:
  • The ComboBox - Cmbchapter stores all chapters orders of the book and in the current string displays the 1st chapter order.
  • The ComboBox - Cmbchapterrecno stores the orders of the KJV database records corresponding to the items stored in the ComboBox - Cmbchapter.
  • The ComboBox - Cmbverse stores all verses orders of the 1st book 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 - Cmbtitlerecno.

    Note:

    The record includes the following data:
    the order and title of the book cooresponding to the item selected,
    the 1st chapter order of the book,
    the 1st verse order of the 1st chapter
    and the contents of the 1st verse.
  • Details ...

    1. Sub Cmbtitle_Click, .procedure:

      1. Algorithm ...


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

        'When you click an item of the ComboBox - Cmbtitle
        Private Sub Cmbtitle_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 Cmbtitle.Enabled = True Then
        Settitle False
        
        adoPrimaryRS.MoveFirst
        Cmbtitlerecno.ListIndex = Cmbtitle.ListIndex
        Cmbbook.ListIndex = Cmbtitle.ListIndex
        'Record number
        recordno = Val(Trim(Cmbtitlerecno.Text))
        
        'Cmbchapter, Cmbverse, Cmbchapterrecno, Cmbverserecno controls
        
        Cmbchapter.Clear
        Cmbchapterrecno.Clear
        Cmbverse.Clear
        Cmbverserecno.Clear
        
        '  The Cmbchapter stores all chapters orders of the book corresponding to the item selected.
        '  The Cmbchapterrecno stores the orders of the KJV  records corresponding to the items of Cmbchapter
        
        '  The Cmbverse stores all verses orders of the 1st chapter of the book. 
        '  The Cmbverserecno stores the orders of the KJV  records corresponding to the items of Cmbverse
        
        With AdRecordset1
        	.MoveFirst
        	.Move (recordno)
        	'chapter values
        	vchapter0 = Trim(.Fields(2).Value)
        	vchapter1 = vchapter0
        	Cmbchapter.AddItem Trim(.Fields(2).Value)
        	Cmbchapterrecno.AddItem Str(Val(.AbsolutePosition) - 1)
        	
        	Cmbverse.AddItem Trim(.Fields(3).Value)
        	Cmbverserecno.AddItem Str(Val(.AbsolutePosition) - 1)
        	
        	Do While Not .EOF
        		If Trim(.Fields(1).Value) = Trim(Cmbtitle.Text) Then
        			If Trim(.Fields(2).Value) <> vchapter1 Then
        				vchapter1 = Trim(.Fields(2).Value)
        				Cmbchapter.AddItem Trim(.Fields(2).Value)
        				Cmbchapterrecno.AddItem Str(Val(.AbsolutePosition) - 1)
        			Else
        			If Trim(.Fields(2).Value) = vchapter0 Then
        				Cmbverse.AddItem Trim(.Fields(3).Value)
        				Cmbverserecno.AddItem Str(Val(.AbsolutePosition) - 1)
        			End If
        			End If
        		Else
        			'1- The record displays into the Record data boxes, includes the following data:
        			' the order and title of the book cooresponding to the item selected,
        			' the 1st chapter order of the book,
        			' the 1st verse order of the 1st chapter
        			' and the contents of the verse.
        			'2- In the Cmbtitle, displays the item selected
        			'3- In the Cmbbook, displays the order of the book corresponding to the item selected.
        			'4- In the Cmbchapter, displays the 1st chapter order of the book
        			'5- In the Cmbverse, displays the 1st verse order of the 1st chapter
        			
        			Cmbchapter.ListIndex = 0
        			Cmbchapterrecno.ListIndex = Cmbchapter.ListIndex
        			Cmbverse.ListIndex = 0
        			Cmbverserecno.ListIndex = Cmbverse.ListIndex
        			adoPrimaryRS.Move (recordno)
        			Call LabelAddress
        			Settitle True
        			
        			If Cmbtitlerecno.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 the all testing work probably, the operation is completed.
    5. The CD-Rom - TeachVB stores the analogue application in the folder \\Projects VB\Test VB8a.
      If you want to run it:
      1. Copy the folder Test VB8a from the CD-Rom - TeachVB onto C: drive.
      2. Remove the read-only attribute of all files in the folder C:\Test VB8a.
      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 VB8a\TestVB0.vbp) and then click Open.
      5. From Run menu , choose and click Start.
    Return