VERSION 5.00
Begin VB.Form P_StaffReports 
   Caption         =   "P_StaffReports"
   ClientHeight    =   8115
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9045
   LinkTopic       =   "Form1"
   ScaleHeight     =   8115
   ScaleWidth      =   9045
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdView 
      Caption         =   "View"
      Height          =   615
      Left            =   6240
      TabIndex        =   2
      Top             =   600
      Width           =   1575
   End
   Begin VB.TextBox txtID 
      Height          =   615
      Left            =   3120
      TabIndex        =   0
      Top             =   600
      Width           =   2775
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Enter Employee ID :"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   480
      TabIndex        =   1
      Top             =   720
      Width           =   2520
   End
End
Attribute VB_Name = "P_StaffReports"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdView_Click()

Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim strCNString As String

strCNString = "Data Source=" & App.Path & "\PayrollBakeryDB.mdb"
cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
cn.ConnectionString = strCNString

cn.Open
    With rs
        .Open "SELECT emp_id FROM Employees", cn, adOpenDynamic, adLockOptimistic
         Do Until .EOF
            If !emp_id = txtID.Text Then
            
            intFound = 1
            End If
            .MoveNext
          Loop
          .MoveFirst
          If intFound = 0 Then
                   MsgBox "Employee ID not found !", vbExclamation, "Search"

                   txtID.Text = ""
                   With txtID
                       .SelStart = 0
                       .SetFocus
                   End With
          End If
     End With
     
    Dim rsx As New ADODB.Recordset
  
    rsx.Open "SELECT emp_id, position, Fname, Lname, age, dob, gender, address, phone, country, race, Staff_Type, basic_salary, salary_id FROM employees", cnn, adOpenDynamic, adLockPessimistic
    
    With EmpReport
        Set .DataSource = rsx
        
        .Show
    End With
    rsx.Close

End Sub
