Solved

Day of Week   Weekday function

Posted on 2014-04-29
6
631 Views
Last Modified: 2014-04-29
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.
0
Comment
Question by:James Powell
6 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 40029699
Format(Weekday([Date of import]), "ddd")

or

Format(Weekday([Date of import]), "dddd")
0
 
LVL 11

Expert Comment

by:Simone B
ID: 40029700
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?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40029706
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")
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 36

Expert Comment

by:PatHartman
ID: 40029713
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.
0
 
LVL 1

Author Closing Comment

by:James Powell
ID: 40030038
Works amazing!  Thank you very much for your help!
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40030354
glad I could be of assistance.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question