Syntax for applying a module function to a field in a query?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have function module that converts date to fiscal year called FiscalYear.
I have a query with date fields, say, StartDate & EndDate that need to be
shown as Fiscal years. How do I construct the syntax? I tried the folowing:
In query design view for a field I typed in
SDFY:[FiscalYear]tablename.StartDate and tried diffeent positions & types of
parenthesis This gives me a syntax error. If only lable SDFY:[FiscalYear]
then it simply asks for fiscal year and reproduces these in the added column.
Help??
 
Hi:

In query type
SDFY:FiscalYear([tablename].[StartDate])

Make sure tablename is part of the query table list. The VBA function should
have a parenthesis following the name and the arguments are the fields in
the query.

Regards,

Naresh Nichani
Microsoft Access MVP
 
Thanks Naresh

Your help to this simple question is valuable. It took me a little while to
figure this one out after posting the question.

Once again much appreciated.

A personal q: Where r u? wld like to keep in touch.

CK

Naresh Nichani said:
Hi:

In query type
SDFY:FiscalYear([tablename].[StartDate])

Make sure tablename is part of the query table list. The VBA function should
have a parenthesis following the name and the arguments are the fields in
the query.

Regards,

Naresh Nichani
Microsoft Access MVP



K said:
I have function module that converts date to fiscal year called FiscalYear.
I have a query with date fields, say, StartDate & EndDate that need to be
shown as Fiscal years. How do I construct the syntax? I tried the
folowing:
In query design view for a field I typed in
SDFY:[FiscalYear]tablename.StartDate and tried diffeent positions & types
of
parenthesis This gives me a syntax error. If only lable SDFY:[FiscalYear]
then it simply asks for fiscal year and reproduces these in the added
column.
Help??
 
Back
Top