user3241846
user3241846

Reputation: 677

MS Access db error

Im getting a error 3061 too few parameters at this line

Set rs = db.OpenRecordset(strSQL)

This is the full code

Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset ''Requires reference to Microsoft DAO x.x Library
Set db = CurrentDb()
MsgBox Me.LName
MsgBox Me.EmpID
strSQL = "SELECT LastName AS damn FROM [Employees]" & _
                 "WHERE [Employees].EmployeeID = Me.EmpID"
Debug.Print strSQL
Set rs = db.OpenRecordset(strSQL)
MsgBox rs!damn
Me.LName = rs!damn
MsgBox Me.LName
rs.Close
db.Close

Upvotes: 1

Views: 97

Answers (1)

Newd
Newd

Reputation: 2185

Best I can assume is that

"WHERE [Employees].EmployeeID = Me.EmpID" 

should be

"WHERE [Employees].EmployeeID = " & Me.EmpID

Plus HansUp has given you a great way to troubleshoot this in the future.

Upvotes: 3

Related Questions