day: Day([Date])

clean32

Registered User.
Local time
Tomorrow, 10:12
Joined
Jun 28, 2016
Messages
36
hello

trying to use the above in a field. example DATE field 12/jun/16. the day function is returning 12/jun/1900

got me stumped ( again)

i need just the dat IE 12, so i can do other stuff with it
 
Wow, very efficient. I've never seen that many reserved word violations in such a short amount of code:

Code:
day: Day([Date])

There are certain words you shouldn't use for field names (https://support.microsoft.com/en-us/kb/286335), doing so can cause coding more difficult and unexpected results. I don't know if that's the issue in this case, but you should rethink your field names (day and Date are both functions and shouldn't be used as names).


Also, I found it really weird you are getting that return value. Day() doesn't return a date, it returns a number, and if you don't pass it a valid date it yells at you (Data type mismatch). Replace your field names and try again. If that doesn't work, try a different date just to test it.
 
ok you learn something every day.

this has just answered another problem i have been having and posted else where. ie do not name query and forms "report"

i used format. now i am trying to nest that format into an iff

1: iff(( Format([DATE]," dd")="01",[DATE],Null)
 
How about we focus on what you are trying to accomplish and not the code you are writing. Can you write a plain-language sentence describing what you are trying to do? Try to lay off database jargon and function talk. Something like:

If its the first day of the month then I want....
 
in a query i have a IDfield and a datee field. next field i have 1 then 2 then 3, for the days of the month.

i wish to poke the date from the date field into the field with its corresponding day

so i was thinking along the lines of 1: iff (( [datee]"dd")="1",[datee],null)

the next query based on that query, will have sort and count. to remove the mutilpul IDfields. leaving 1 IDfield and the 1-31 fields full of dates
 
Nope, not liek that at all. No code talk. Tell me about what the data represents in plain language--no database terms.
 
If you are dealing with field names that contain 1-31 as part of the names as a way to represent days of the month, you also have a normalization problem. We would DEFINITELY need a good verbal description of the goals. Starting from code rather that from goals leaves US guessing at your intent.
 

Users who are viewing this thread

Back
Top Bottom