I am attempting to run the following code...
Dim EESQL As String
Dim db As Database
Dim rs As DAO.Recordset
EESQL = "SELECT Max(os_claims.EmployeeID) AS MaxOfEmployeeID " & _
"FROM os_claims " & _
"WHERE (((os_claims.DateClosed) Is Null) AND ((os_claims.ArchivedRecord)=False) AND ((os_claims.EmployeeID)=[forms]![frmEmployees]![id]));"
Set db = CurrentDb
Set rs = db.OpenRecordset(EESQL)
Me.selectedEEFound.Value = rs.Fields("MaxOfEmployeeID").Value
Set rs = Nothing
Set db = Nothing
...but when I do, I received a "Too Few Parameters. Expected 1" error. Through debugging, I know there error is occurring at the "Set rs = db.OpenRecordset(EESQL)" line in the code...but I don't know why.
If I paste the sql code into a query, it runs fine without any issues or errors.