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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format Date into Quarters in SQL qry 1

Status
Not open for further replies.

aine

Programmer
Apr 15, 2003
11
0
0
IE
Hi

I am running three qrys to enter dates into three combo boxs.

1 box is for the dates in month format.
01/01/03 to January 2003

2 box is for the dates in Year format.
01/01/03 to 2003

3 box is for the dates in Quarter format.
01/01/03 to Q1 2003
07/01/03 to Q3 2003

The following work for the month and year formats but I can't seem to get Quarters working.

strSQL = "SELECT Format([Date],'mmmm yyyy') AS [Months] FROM [MONTHS];"

strSQL = strSQL = "SELECT Format([Date],'yyyy') AS [Years] FROM [YEARS];"

***Problem***
strSQL = "SELECT Format([Date],'q yyyy') AS [Quarters], FROM [QUARTERS];"

***Error***
error 3141, select statement has reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.

does anyone know the proper way to format this

thanks

aine

 
Try removing the comma at the end of the select clause.

...AS [Quarters], FROM ...

Thanks and Good Luck!

zemp
 
Thanks zemp

I am feeling very stupid now as it was so obvious.
I think I have been staring at code to long

Aine
 
We have all been there. Keep smiling, keep coding.

Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top