Solved Syntax error when filtering year and date (1 Viewer)

cheberdy

Member
Local time
Today, 12:20
Joined
Mar 22, 2023
Messages
77
I always get a syntax error when I try to pull the year and month from a date.
My code in the query is
Code:
Year: Format([date]; "yyyy");
and
Code:
Day: Format([date]; "dd");
if I do the same with month it works. Am I doing something wrong?
 

ebs17

Well-known member
Local time
Today, 12:20
Joined
Feb 7, 2020
Messages
1,946
Remove the semicolon behind the closing parenthesis.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:20
Joined
Sep 21, 2011
Messages
14,301
Why not just use the functions by the same name?, or is there a reason you want a string?
 

Josef P.

Well-known member
Local time
Today, 12:20
Joined
Feb 2, 2023
Messages
826
What does the expression look like in the SQL view?
 

cheberdy

Member
Local time
Today, 12:20
Joined
Mar 22, 2023
Messages
77
What does the expression look like in the SQL view?
Format([date],"""yyyy""") AS year
Format([date],"""dd""") As day
I don't know why there are three quotation marks now. It keeps jumping back to this.
 

Josef P.

Well-known member
Local time
Today, 12:20
Joined
Feb 2, 2023
Messages
826
Format([date],"""yyyy""") AS year
Format([date],"""dd""") As day
I don't know why there are three quotation marks now. It keeps jumping back to this.
Ok, your office language is not English. ;)

SQL:
Code:
Format([date], "yyyy") as year

In German Office language, the expression in the query editor should look like this:
Code:
Year: Format([date]; "jjjj")

Note: This automatic translation bothers me, so I always set the language to English on the development PC.
 

cheberdy

Member
Local time
Today, 12:20
Joined
Mar 22, 2023
Messages
77
Ok, your office language is not English. ;)

SQL:
Code:
Format([date], "yyyy") as year

In German Office language, the expression in the query editor should look like this:
Code:
Year: Format([date]; "jjjj")
Thanks
 

Users who are viewing this thread

Top Bottom