Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Year from a Date field in A query?

Status
Not open for further replies.

PogoWolf

Programmer
Mar 2, 2001
351
0
0
US
I'm trying to write a Query that will return all the unique Years from a column that is a date field...

any ideas on how this can be done??

thanks!!!!! ---===///The PogoWolf\\\===---
Darkness..Bleakness..Plastic forks..?

 
MyYear: Format([MyDateField],"yyyy")

Set the query to only pull unique values in query properties. Run!

Joe Miller
joe.miller@flotech.net
 
that worked!.. kinda.. =)

I'm writting this on an ASP page, with an Access (2k) DB.. Internal to Access the query below works fine...

but in ASP.. it returns an error?!
(I've also posted this reply to the ASP form. =)

SELECT DISTINCT [WhatsNew].[Date] FROM WhatsNew WHERE (((Format([whatsnew.date],"yyyy")=2001)));

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

---===///The PogoWolf\\\===---
Darkness..Bleakness..Plastic forks..?

 
Try doing a response.write on your SQL code and see what the actual query looks like. It seems like you aren't passing down something that the DB wants.

Michiko
 
added note:
come to find out it might be an issue between OBDC and Access handles SQL statments.. I changed the Commands over to BETWEEN #X# and now it's working nicly. =)

thanks for the help again, =)
---===///The PogoWolf\\\===---
Darkness..Bleakness..Plastic forks..?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top