I wrote a SQL query in MS Access that uses the MonthName function. In access it works flawlessly. I copied the exact SQL statement into an excel module that I frequently use to query databases. When I run the query, excel keeps telling me that MonthName is an undefined function name. If I remove the MonthName portion, the query runs fine.
It seems like I'm missing a reference or something... Right now, I'm referencing Microsoft ActiveX Data Objects Library 6.0. Can anyone point me in the right direction? Thanks
strSQL = "SELECT DISTINCT Customers.CustomerName, Employees.EmployeeName, [Policy data revised].EXDT, MonthName(Month([EXDT])) AS expMonth
FROM (([Service Team table]
INNER JOIN Customers
ON [Service Team table].CustID = Customers.CustID)
INNER JOIN Employees
ON [Service Team table].EmployeeID = Employees.EmployeeID)
INNER JOIN [Policy data revised]
ON Customers.CustID = [Policy data revised].CustID
WHERE ((([Service Team table].RoleExtension)='2. Underwriting Assistant')
AND (([Policy data revised].EXDT)
BETWEEN #" & minExpDt & "# AND #" & maxExpDt & "#))
ORDER BY [Policy data revised].EXDT ASC;"