I am building a calendar on my web site for my users. I need code that will get JUST the year, or month, or day from DateTime so I can use it in my Sql Statement to extract the events for that specific user for the month. Does anyone know what that is?
Jim
Use the format function: example Format(yourfield,"yyyy" see the Format Function section in access help for further information.
The second way is using Year,Month or day functions. examples:- Year(yourfield),Month(yourfield) or day(yourfield) to get the month of the current date use this Month(Date())
Chris's response prompts me to add a tip (that took me a while to realize): The regular Access Help is not very useful if you look up VBA functions such as "format." However, if you use the ALT+F11 combination to open the VBA editor and then press F1 you get VBA specific help and much better responses to searches for functions.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.