Function In Where Clause?

J

Joe Delphi

Hi,

Are there any limitations to using an Access function in the WHERE
clause of a query that is part of a view? My Access project uses MS SQL
Server on the back end. So I will be creating some views for the display of
data.

I have a function named GetCurrentMonth which returns a string of
YYYYMM (e.g. 200507). I want to use that function in the query for a view
like this:

SELECT FNAME, LASTNAME, EMPLOYEE_ID
FROM EMPLOYEES
WHERE MONTH = GetCurrentMonth

Whenever I specify the function in the WHERE clause using the query
designer, the system automatically puts an =N( ) around it. Why is
this? Is this correct behavior for MS Access 2002? It then gives me some
message about =N(GetCurrentMonth) is not a defined function in Access.

How can I use the function in the WHERE clause of my query?


JD
 
L

Larry Linson

SQL doesn't know Access functions -- you have to use T-SQL functions in
Microsoft SQL Server objects.

Larry Linson
Microsoft Access MVP
 
Top