'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
"SELECT * FROM Employees WHERE Emp_ID='" & txtID.Text & "'"
If Emp_ID is a numeric field:
Code:
"SELECT * FROM Employees WHERE Emp_ID=" & txtID.Text
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana