Results 1 to 5 of 5

Thread: data report problem..

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    31

    data report problem..

    'i need to view employees record when type in emp id to view that row record
    'please help me. thanks
    ' or i need giv all project code for more infomation ?

    Code:
    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
         
         'i need to view employees record when type in emp id to view thet entire record
         'please help me. thanks
        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
    Attached Files Attached Files

Posting Permissions

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



Click Here to Expand Forum to Full Width