O
Orlando
Hi, I am trying to run this code and I get an error in this line of the code.
Set rs = db.OpenRecordset(vSql, dbOpenDynaset)
The error is:
Run-Time error '3061'
Too few parameters. expected 1
I just want to type the employee ID and display the name of the employee en
another box, I will display some more information as soon this code works, I
have check a lot of examples of OpenRecordset in this discussion group but I
haven't find the mistake.
I would really appreciate if someone can help me.
Thanks
Private Sub Command7_Click()
Dim vSql As String
Dim db As Database, rs As Recordset
vSql = ""
vSql = "Select employees.EmpID, employees.FirstName " _
& "from employees where Employees.EmpID = " & Me.EmpID
Set db = CurrentDb
Set rs = db.OpenRecordset(vSql, dbOpenDynaset)
If rs.RecordCount > 0 Then
Me.FirstName.Value = rs!FirstName
Else
Me.FirstName.Value = "ERROR - el depto que ingreso no existe, verifique"
Me.EmpID.SetFocus
Exit Sub
End If
rs.Close
Set db = Nothing
End Sub
Set rs = db.OpenRecordset(vSql, dbOpenDynaset)
The error is:
Run-Time error '3061'
Too few parameters. expected 1
I just want to type the employee ID and display the name of the employee en
another box, I will display some more information as soon this code works, I
have check a lot of examples of OpenRecordset in this discussion group but I
haven't find the mistake.
I would really appreciate if someone can help me.
Thanks
Private Sub Command7_Click()
Dim vSql As String
Dim db As Database, rs As Recordset
vSql = ""
vSql = "Select employees.EmpID, employees.FirstName " _
& "from employees where Employees.EmpID = " & Me.EmpID
Set db = CurrentDb
Set rs = db.OpenRecordset(vSql, dbOpenDynaset)
If rs.RecordCount > 0 Then
Me.FirstName.Value = rs!FirstName
Else
Me.FirstName.Value = "ERROR - el depto que ingreso no existe, verifique"
Me.EmpID.SetFocus
Exit Sub
End If
rs.Close
Set db = Nothing
End Sub