473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Day number to day name

HI, i have a query that gives me the number of the day, ei: sunday is
1, monday is 2 .....saturday is 7
What i wanna do is take that 2 and bring it back to Monday. How can i
do this? IS there a way to do this in a report?? I know its easy to do
in vba, but i ask criteria in my report and each time a run it it give
me a bug......
Can i do it in a query too???

thx

Feb 1 '06 #1
8 12651
No***********@hotmail.com wrote:
HI, i have a query that gives me the number of the day, ei: sunday is
1, monday is 2 .....saturday is 7
What i wanna do is take that 2 and bring it back to Monday. How can i
do this? IS there a way to do this in a report?? I know its easy to do
in vba, but i ask criteria in my report and each time a run it it give
me a bug......
You can cheat by using the fact that January 1, 2006 was on a Sunday.

Format(DateSerial(2006, 1, X), "dddd")

Example:
Format(DateSerial(2006, 1, 2), "dddd") => Monday
Can i do it in a query too???

thx


For a query I might use CStr to make sure it's treated as a string if I
encounter a problem.

CStr(Format(DateSerial(2006, 1, [DayNumber]), "dddd")) As DayOfWeek

James A. Fortune
CD********@FortuneJames.com

Feb 1 '06 #2
CD********@FortuneJames.com wrote:
No***********@hotmail.com wrote:
HI, i have a query that gives me the number of the day, ei: sunday is
1, monday is 2 .....saturday is 7
What i wanna do is take that 2 and bring it back to Monday. How can i
do this? IS there a way to do this in a report?? I know its easy to do
in vba, but i ask criteria in my report and each time a run it it give
me a bug......


You can cheat by using the fact that January 1, 2006 was on a Sunday.

Format(DateSerial(2006, 1, X), "dddd")

Example:
Format(DateSerial(2006, 1, 2), "dddd") => Monday
Can i do it in a query too???

thx


For a query I might use CStr to make sure it's treated as a string if I
encounter a problem.

CStr(Format(DateSerial(2006, 1, [DayNumber]), "dddd")) As DayOfWeek

James A. Fortune
CD********@FortuneJames.com


I also tried Format(X, "dddd") which seems to work but it gave me a bad
feeling when I used it.

James A. Fortune
CD********@FortuneJames.com

Feb 1 '06 #3
If I understand correctly, you can just use the WeekDayName Function. In the
Field section of your query:

DayName: WeekdayName([DayNumber])

Gina

No***********@hotmail.com wrote:
HI, i have a query that gives me the number of the day, ei: sunday is
1, monday is 2 .....saturday is 7

What i wanna do is take that 2 and bring it back to Monday. How can i
do this? IS there a way to do this in a report?? I know its easy to do
in vba, but i ask criteria in my report and each time a run it it give
me a bug......

Can i do it in a query too???

thx


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 1 '06 #4
Gina via AccessMonster.com wrote:
If I understand correctly, you can just use the WeekDayName Function. In the
Field section of your query:

DayName: WeekdayName([DayNumber])

Gina


Note that that function is not part of A97.

James A. Fortune
CD********@FortuneJames.com

Feb 1 '06 #5
No***********@hotmail.com wrote:
HI, i have a query that gives me the number of the day, ei: sunday is
1, monday is 2 .....saturday is 7
What i wanna do is take that 2 and bring it back to Monday. How can i
do this? IS there a way to do this in a report?? I know its easy to do
in vba, but i ask criteria in my report and each time a run it it give
me a bug......

weekdayname(weekday(date()))

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Feb 1 '06 #6
CD********@FortuneJames.com wrote in
news:11**********************@g44g2000cwa.googlegr oups.com:
Gina via AccessMonster.com wrote:
If I understand correctly, you can just use the WeekDayName
Function. In the Field section of your query:

DayName: WeekdayName([DayNumber])

Gina


Note that that function is not part of A97.

James A. Fortune
CD********@FortuneJames.com

so create it in a module
public function weekdayname( daynum as integer) as string
select case daynum
case 1
weekdayname = "Sunday"
case 7
weekdayname = "Saturday"
case else
weekdayname = "Frustrationday"
end select

end function
--
Bob Quintal

PA is y I've altered my email address.
Feb 2 '06 #7
I was wondering how you determined the day number in the first place. If
you already have the date which the day number refers to then to get the
day name simply use:

Format(dtMyDate,"dddd")
*** Sent via Developersdex http://www.developersdex.com ***
Feb 2 '06 #8
yes i have a date field., i'll give each solution a try.

thx a lot, keep thos answers coming.

Feb 2 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: fotokard | last post by:
I am new to sql query and have a question. I would like to display row column values as column names. questions table consisted of question_id, group_id, question response table consisted...
0
by: johkar | last post by:
My XML and XSL is below. Also below is a textual representation of what I want to get out of the XML with XSL. For each Extension node in XML, I am only concerned with those nodes with...
2
by: teddysnips | last post by:
SQL Server 2000 8.00.760 (SP3) I've been working on a test system and the following UDF worked fine. It runs in the "current" database, and references another database on the same server called...
11
by: Ken Varn | last post by:
I want to be able to determine my current line, file, and function in my C# application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___ macros for getting this, but I cannot find a...
2
by: Giovane Calabrese | last post by:
( aspx + vb ) hi everyone ! I really need make that function work ! im brazilian , and i want to make a multilanguage system , that function above must look at all ASPX take the labels ID and...
2
by: mayur | last post by:
Hi, Can anyone help me with the following error I am getting in my asp.net application. The number name 'System.Web.UI.WebControls' contains more than the maximum number of prefixes. The maximum...
2
by: drsudhak | last post by:
Hi every I Have to get Printer Name For Given Port Number/Name using VB6.0 Code
26
by: Scotter | last post by:
Ok, I have 3 tables, one with a customer ID(PK) number and info about the customer(customer table). Another table with an order number(PK), with payment info and such, bieng linked by the customer...
2
by: pythonnewb | last post by:
I am fairly new to programming but have some very basic Java background. I am just learning python and tried to make a module that would allow me to create a file containing an address book. I was...
4
by: Blaikie | last post by:
Hello everyone! I'm using Access 2000 and working with an old database but need some help. I have a query displaying information from the database each week which has several columns, date,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.