I am trying to use
Month: Trim(Mid([Date & Time],InStr(1,[Date & Time],"/")+1,InStr(InStr(1,[Date & Time],"/")+1,[Date & Time],"/")-InStr(1,[Date & Time],"/")))
But i end up with an extra /
For example: 1/11/2019 ends up giving me 11/
I am trying to use
Month: Trim(Mid([Date & Time],InStr(1,[Date & Time],"/")+1,InStr(InStr(1,[Date & Time],"/")+1,[Date & Time],"/")-InStr(1,[Date & Time],"/")))
But i end up with an extra /
For example: 1/11/2019 ends up giving me 11/
MyMonth: month([Date & Time])
oops, my bad, I meant day. I get the month fine but i need the day. So I ran with your oh so easy idea and get Day: Day([Date & Time])
I would say that is somewhat easier than my first idea.
Thank you
you need to be clear about what you have. Date and Time are both reserved names meaning today and the time now (Now is a combination of both)
So if you are using Date and Time as the Date and Time functions, i.e. Now then you should be aware that date/time fields are numeric, not a string. What you see as 01/15/2018 is just a format of the number. As a number you do not use string functions such as Trim and &. you would add them together - Date+Time (or Now if you prefer)
Alternatively if your Date and Time are strings then VBA is probably confused about whether to use your field or the function.
And if you are only trying to find the month, you do not need the time element
Edit: Day is also a reserved word - as you can see because it is a function