Heidestrand
Registered User.
- Local time
- Today, 06:50
- Joined
- Apr 21, 2015
- Messages
- 73
Hello,
I want to build a query that calculates the fiscal year and the month from a date on-the-fly. I tried to do it in VBA, but it's more complicated than in query I guess. So this is my table:
The date is on the left, in the middle I want to have calculated Jan 14 and on the right I want 14/15.
In VBA I started with this: strMonth = MonthName(Month(A), True) & " " & Format(A, "YY") which gave me "Jan 08". But the date was hard-coded and not from my table. Then I tried to store the information by the help of a SQL statement into a string. But this also didn't work, the types were different.
Then I stumbled upon this Microsoft page but the code also wasn't really helping me. I tried to alter it to this code:
.. but I guess it's wrong, it gives me a syntax error.
So it would be really great if you can help me with this
Thanks in advance,
Heide
I want to build a query that calculates the fiscal year and the month from a date on-the-fly. I tried to do it in VBA, but it's more complicated than in query I guess. So this is my table:

The date is on the left, in the middle I want to have calculated Jan 14 and on the right I want 14/15.
In VBA I started with this: strMonth = MonthName(Month(A), True) & " " & Format(A, "YY") which gave me "Jan 08". But the date was hard-coded and not from my table. Then I tried to store the information by the help of a SQL statement into a string. But this also didn't work, the types were different.
Then I stumbled upon this Microsoft page but the code also wasn't really helping me. I tried to alter it to this code:
Code:
UPDATE tblSAPOD
SET sapOD_month = Year([sapOD_OrderDate])-IIf([sapOD_OrderDate]<
DateSerial(Year([sapOD_OrderDate]),6,16),1,0)
WHERE sapOD_OrderDate Like "*/*/94";
So it would be really great if you can help me with this

Thanks in advance,
Heide