Hey Paul ~ Can't thank you enough for teaching me how to fish
I use DBPrint regularly - But never used it to test the code result in SQL - Very cool! Thank You Again!
So after trying every DATE 'this' and DATE 'that' - MONTH 'this' MONTH 'that' function in SQL
I have come to the conclusion what I'm trying to do - Get SQL/Access to recognize the string value of a Month as a Month as opposed to just a character string
And yet - I'm convinced I should be able to click March 2020 in a ComboBox and pull results for February 2020 -
The concept is just too simple to believe it can't be done - and yet here I am (again) Ugh!!!!
Here are some of the code samples of what I've tried - Some produce predictiable but un workable results and some produce unpredictible results.
E.g., Why does SELECT Format(DateAdd(Year, 0, '2/1/2020'), 'Y') As Year produce a Month/Year result instead of just the Year?? jsmh
I hate not understanding simple things - but I guess until you know them - they're not simple
Code:
SELECT Format(DateAdd(Month, -1, '3/1/2020'), 'MMMM') As Month
SELECT Format(DateAdd(Year, 0, '2/1/2020'), 'Y') As Year
SELECT DateAdd(Month, -1, '3/1/2020') As Month
SELECT DATENAME(MONTH,'3/1/2020') AS BOO
SELECT DATEPART(Month, CAST('1/2/2020' As DateTime))
SELECT MONTH('February')
SELECT MONTHNAME('3/1/2020')
I've got fishing pole in hand if you have time to thow another lesson my way
Again what I'm trying to accomplish - is simply click a ComboBox which is populated with month names and the year
and pull data for the previous month...
Thanks as Always!!