DatePart in Query design mode???

  • Thread starter Niklas Östergren
  • Start date
N

Niklas Östergren

Hi!

Is there anyone that knows the syntax for DatePart function in query design
mode.

I´m trying to produce a QBF but don´t know exactly how to get the result I
want. So right now I´m exerimenting with DatePart in a query to see the
result I get.

I want to get all records from [MemberShipEndDate] for year 2003. The result
I get right now (with the SQL statment below) is zero / nothing. But I DO
have records with [MemberShipEndDate] for 2003 in
[tblMemberValidation].

The questions the user want to get answer on is:
1.) Which person (PersonID) hav valid membership ([MemberShipEndDate] >
Date() )?
2.) Which person had membership last year (ex. 2003)?
3.) Which person had membership last year and have NOT valid membership
today?

All help is appreciated!

TIA!
// Niklas


Her´s the SQL statment I´m using now:
=====================================
SELECT tblMemberValidation.fkPersonID
FROM tblMemberValidation
WHERE
(((([tblMemberValidation].[MemberShipEndDate])=DatePart("yyyy",[MemberShipEn
dDate]))=2003));
 
G

Guest

-----Original Message-----
Hi!

Is there anyone that knows the syntax for DatePart function in query design
mode.

I´m trying to produce a QBF but don´t know exactly how to get the result I
want. So right now I´m exerimenting with DatePart in a query to see the
result I get.

I want to get all records from [MemberShipEndDate] for year 2003. The result
I get right now (with the SQL statment below) is zero / nothing. But I DO
have records with [MemberShipEndDate] for 2003 in
[tblMemberValidation].

The questions the user want to get answer on is:
1.) Which person (PersonID) hav valid membership ([MemberShipEndDate] >
Date() )?
2.) Which person had membership last year (ex. 2003)?
3.) Which person had membership last year and have NOT valid membership
today?

All help is appreciated!

TIA!
// Niklas


Her´s the SQL statment I´m using now:
=====================================
SELECT tblMemberValidation.fkPersonID
FROM tblMemberValidation
WHERE
(DatePart("yyyy",[tblMemberValidation].[MemberShipEn
dDate])=2003);

Try the above
.
 

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