Hello,
I'm calling a macro that passes a SQL statement in as a parameter. Within that statement, I'd like to use the variable EmployeeName as the argument for the Where clause. The code I'm using is below:
Sub CreateActualHoursQuery()
Dim EmployeeName As String
EmployeeName = "Test Employee"
CreateQry "Actual Hours Test", "SELECT Employees.[Employee Name], Projects.[Project Name], [Project Costs].[Month Number], [Project Resources].[Actual Hours] FROM Projects INNER JOIN ([Project Costs] INNER JOIN (Employees INNER JOIN [Project Resources] ON Employees.ID = [Project Resources].[Employee Name]) ON [Project Costs].ID = [Project Resources].[Monthly Date]) ON Projects.ID = [Project Costs].[Project Name] WHERE (((Employees.[Employee Name])= EmployeeName));"
End Sub
Everything works fine, but the query that's created doesn't use the value for EmployeeName that I've declared. Instead, it creates a query parameter that prompts me to enter the parameter whenever I execute the query. How do I write this module, so that it just uses the value for EmployeeName I've specified in code?
I appreciate any assistance.