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

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??
 
N

Naresh Nichani

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
 
G

Guest

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??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top