Solved FindFirst strCriteria syntax (1 Viewer)

evictme

Registered User.
Local time
Today, 03:54
Joined
May 18, 2011
Messages
168
Hello Folks,

I am trying to run a findfirst on a double-click event and I am not sure i have the syntax correct:

The code below is what I have so far but the last piece of criteria "Supervisor" is not working as it should, depending on where I put the single quote, it will either give me any record for that EmployeeID meeting the previous criteria or just not work at all. What am I missing?

SQL:
Set rs = CurrentDb.OpenRecordset("SELECT * FROM [Employee Reviews]")

Dim EmployeeID As Integer
Dim Year As String
Dim Quarter As String
Dim Supervisor As String
Dim strCriteria As String

strCriteria = "EmployeeID=" & Me.EmployeeID & " AND [Year] = '2021'" & " AND Quarter = '3rd Qrtr'" & " AND 'Supervisor = Me.Supervisor'"

rs.FindFirst strCriteria

If Not rs.NoMatch Then

DoCmd.OpenForm "Quarterly-Review", , , strCriteria
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:54
Joined
Oct 29, 2018
Messages
21,357
Let's see, try it this way.
Code:
strCriteria = "EmployeeID=" & Me.EmployeeID & " AND [Year] = '2021' AND Quarter = '3rd Qrtr' AND Supervisor = '" & Me.Supervisor & "'"
 

evictme

Registered User.
Local time
Today, 03:54
Joined
May 18, 2011
Messages
168
Let's see, try it this way.
Code:
strCriteria = "EmployeeID=" & Me.EmployeeID & " AND [Year] = '2021' AND Quarter = '3rd Qrtr' AND Supervisor = '" & Me.Supervisor & "'"
Always with the great help! THank you, this worked perfectly.
 

Users who are viewing this thread

Top Bottom