0
Option Explicit
Dim connectionado As ADODB.Connection
Dim recordsetado As ADODB.Recordset
Dim num As Integer

Private Sub cmdCanceL_Click()
frmSTUDENT.Enabled = True
frmSTUDENT.Show
Unload Me
End Sub

Private Sub openDbaseConnection()
    connectionado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\student\My Documents\dbStudentInfo.mdb;Persist Security Info=False"
    connectionado.Open
    
    recordsetado.ActiveConnection = connectionado
    recordsetado.CursorLocation = adUseClient
    recordsetado.CursorType = adOpenStatic
    recordsetado.LockType = adLockOptimistic
    recordsetado.Open "Select * FROM tblStudentInfo"
End Sub

Private Sub cmdExit_Click()
frmSTUDENT.Show
End Sub

Private Sub cmdSearch_Click()

recordsetado.MoveFirst
For num = 0 To recordsetado.RecordCount - 1
If txtsearch.Text = recordsetado!StudentID Then
frmSTUDENT.txtStudentID.Text = recordsetado!StudentID
frmSTUDENT.txtStudentName.Text = recordsetado!StudentName
frmSTUDENT.txtSection.Text = recordsetado!Section
frmSearch.Hide
frmSTUDENT.Show
txtsearch.Text = ""
Else
recordsetado.MoveNext
End If
Next num
If Not num = recordsetado.RecordCount Then
MsgBox "Not Found"
End If
End Sub

Private Sub Form_Load()

    Set connectionado = New ADODB.Connection
    Set recordsetado = New ADODB.Recordset
    num = 0
    Call openDbaseConnection
    
End Sub

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Jx_Man
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.