473,396 Members | 2,030 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,396 software developers and data experts.

How to compute number of days using a single entry of Date ?

I am developing a application using this fields as required by the
company.
1. Date Login
2. Time IN
3. Time OUT

My question is how to produce the number of days with 1 entry of Date
is the entry ? [Date Login]

Then, after getting the number of Days. Switching is needed for
weekdays and sundays. Note that if the Date is Sunday and that Sunday
does not pass 6 days from the previous Date Login, That Sunday will be
consider as WeekDay otherwise remain as Sunday.

How will I do That ? I already have this field in my query.

WkDay:IIF(Format([Dated],"dddd") <> "Sunday",1,0)

My only problem here is Sunday ’coz I cannot use this query:

Sunday:IIF(Format([Dated],"dddd") = "Sunday",1,0)

Although this will give a value 1 to my Sunday Remark field but it is
not the one required by my Boss. Read my 1st statement above in able
to figure out what to do ’coz I am also reviewing my work here though,
I can’t figure it out yet. Can you help ? I need it ASAP. Thanks

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/MS-Access-co...ict177868.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=597740
Nov 13 '05 #1
1 2255
rock72 wrote:
I am developing a application using this fields as required by the
company.
1. Date Login
2. Time IN
3. Time OUT

My question is how to produce the number of days with 1 entry of Date
is the entry ? [Date Login]

Then, after getting the number of Days. Switching is needed for
weekdays and sundays. Note that if the Date is Sunday and that Sunday
does not pass 6 days from the previous Date Login, That Sunday will be
consider as WeekDay otherwise remain as Sunday.

How will I do That ? I already have this field in my query.

WkDay:IIF(Format([Dated],"dddd") <> "Sunday",1,0)

My only problem here is Sunday ’coz I cannot use this query:

Sunday:IIF(Format([Dated],"dddd") = "Sunday",1,0)

Although this will give a value 1 to my Sunday Remark field but it is
not the one required by my Boss. Read my 1st statement above in able
to figure out what to do ’coz I am also reviewing my work here though,
I can’t figure it out yet. Can you help ? I need it ASAP. Thanks


I have no idea what you are attempting to do. Sorry. However, instead
of your WkDay thingy, you can always use WeekDay(). Weekday() defaults
to Sunday being Day 1 and Saturday being Day 7. However, you can tell
which day the counting is to start from. Today is Wednesday, Dec 8, 2004.

? Weekday(Date(),vbMonday) 'use Monday as the 1st day of week
3
? Weekday(Date()) 'use default of Sunday as 1st day of week.
4

If you use vbMonday, but need to have it work in a query, you need to
substitute the value of vbMonday to its numeric value. Ex:
? vbMonday
2

Would you be better off using 2 date/time fields and store a value like
Now() to them? That way you have the starting day/time as well as the
ending day/time. You can extract the date from both...as well as the
time. You can add/subtract from them with date/time functions.

Some functions you may want to look at in on-line help are DateSerial,
TimeSerial, DateDiff, DateAdd, Year, Month, Day, Now, Date, Time, Hour,
Minute, Second.

Also check out http://www.mvps.org/access/datetime/index.html
Nov 13 '05 #2

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

Similar topics

7
by: Shuffs | last post by:
Could someone, anyone please tell me what I need to amend, to get this function to take Sunday as the first day of the week? I amended the Weekday parts to vbSunday (in my code, not the code...
0
by: rock72 | last post by:
I am developing a application using this fields as required by the company. 1. Date Login 2. Time IN 3. Time OUT My question is how to produce the number of days with 1 entry of Date is...
4
by: GiladP1 | last post by:
Hi, I want to copy protect my application. I want to limit its use for a given period of time, say 30 days, after which a license key will be needed. There are various issues to consider here...
1
by: wildbill | last post by:
I'm looking for an example of how to compute an age of a record in a query and then display that on a form. For example: I have record that shows it was entered on 8/2/2005. I would like to be...
29
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An...
4
by: CDMAPoster | last post by:
I'm starting to come up with a version of DateAdd that I call BusinessDateAdd that adds the selected number of business days. It's still in preliminary form (needs testing) and interacts with my...
2
by: vspsdca | last post by:
Hi, I'm quite new to the world of VBA so any help you could extend will help me a lot with my project. I have a database of Change Requests from our users. I have two date boxes, one is Date...
5
FishVal
by: FishVal | last post by:
IMHO, the following is not a how-to-do instruction to solve a particular problem but more a concept-proof stuff demonstrating possibilities of SQL. So, let us say the problem is to calculate...
25
by: DanicaDear | last post by:
Hello again Bytes...I missed you! First, background: In a hotstick lab, we ship orders every two years. We ship a new order and the customer uses the new box to return the previous year's order....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.