Link to home
Start Free TrialLog in
Avatar of James Powell
James PowellFlag for United States of America

asked on

Day of Week Weekday function

Expr1: (WeekdayName([DateofImport],True,1))


I'm trying to get this to work...based on evaluating a date field..

but I get a "Func#"  error...

How can I adjust the syntax ?

I'd rather do this in a single step, instead of evaluating as a number...and then doing a secondary update query...

if I can convert the [Date of import] to a numeric field...and then get the Day of Week text...that'd be ideal.


Thanks for any guidance.
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SELECT DATENAME(dw,DateofImport) FROM TableName

Edit: Sorry, just saw the categories. The above is SQL, not Access. Not sure which you're looking for?
try this, you may need to change the position of the days, depending on your settings


choose(weekday([Date of import]), "Mon","Tue","Wed","Thu","Fri","Sat","Sun")
I'm not sure why you are updating a table with this value.  You should be calculating it whenever you need it.

This is a two step process.  If you read the help entry for Weekdayname or even read what intellisense displays when you enter the expression, you will see that the first argument is a long integer.  That means that it isn't a date.  So first you need to find the day of the week for the particular date and only then can you convert that into a name for the weekday.

Expr1: (WeekdayName(WeekDay([DateofImport],1),True,1))


Wow!!!!  A lot of people posted ahead of me while I answered the phone.  Dale's answer is simpler than mine since it only uses a single function.
Avatar of James Powell

ASKER

Works amazing!  Thank you very much for your help!
glad I could be of assistance.