Solved

Day of Week   Weekday function

Posted on 2014-04-29
6
528 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 119

Expert Comment

by:Rey Obrero
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 34

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now