473,320 Members | 1,951 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,320 software developers and data experts.

Week

I have a work assignment that

gives me a date

and I want to find all other dates in that week.

Any ideas?
Nov 12 '05 #1
4 1666
scorpion53061 wrote:
I have a work assignment that

gives me a date

and I want to find all other dates in that week.

Any ideas?

Well, if you know the date, there is the WeekDay() function to tell you
what day of the week it is. And it depends on what day of the week you
want to start your week from.

From there you can use the DateAdd to determine the dates using For/Next.

Nov 12 '05 #2
On Fri, 30 Apr 2004 23:40:27 -0500, scorpion53061 wrote:
I have a work assignment that

gives me a date

and I want to find all other dates in that week.

Any ideas?


Sub FindDate()
Dim dteDate As Date
Dim intY As Integer
Dim intX As Integer
dteDate = InputBox("Enter the Date")
intX = Weekday(dteDate) - 1

dteDate = dteDate - intX
For intY = 1 To 7
Debug.Print dteDate
dteDate = dteDate + 1
Next intY

End Sub

Your next work assignment is to explain what is happening here. :-)
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #3

"scorpion53061" <sc************@nospamhereeveryahoo.com> wrote in message
news:10*************@corp.supernews.com...
I have a work assignment that

gives me a date

and I want to find all other dates in that week.


Here are two functions that may be of help, given a date, to return the
first day of the week and the last day of the week:

Function FDOW(pdatADay As Date) As Date
If Weekday(pdatADay) = 1 Then
FDOW = pdatADay
Else
FDOW = DateAdd("d", pdatADay, -Weekday(pdatADay) + 1)
End If
End Function

Function LDOW(pdatADay As Date) As Date
If Weekday(pdatADay) = 7 Then
LDOW = pdatADay
Else
LDOW = DateAdd("d", pdatADay, 7 - Weekday(pdatADay))
End If
End Function
Nov 12 '05 #4
no problem.

It is a time card app that my predecessor wrote in access but he used a text
instead of 'date' field column type. (Why!!!!)

Payroll wanted to see the payroll divided up by week.
(Sun - Sat)

I am having some problems with these functions but thank you guys for
getting me started. If you have any more ideas please post....

"fredg" <fg******@example.invalid> wrote in message
news:tx****************************@40tude.net...
On Fri, 30 Apr 2004 23:40:27 -0500, scorpion53061 wrote:
I have a work assignment that

gives me a date

and I want to find all other dates in that week.

Any ideas?


Sub FindDate()
Dim dteDate As Date
Dim intY As Integer
Dim intX As Integer
dteDate = InputBox("Enter the Date")
intX = Weekday(dteDate) - 1

dteDate = dteDate - intX
For intY = 1 To 7
Debug.Print dteDate
dteDate = dteDate + 1
Next intY

End Sub

Your next work assignment is to explain what is happening here. :-)
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 12 '05 #5

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

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
21
by: .:mmac:. | last post by:
I have to update a page every week. I get the page ahead of time so I used the "scheduled includes" webbot in Frontpage only to find that I would have to refresh the page every week to have it...
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...
14
by: deko | last post by:
This runs, but does not narrow to current week. suggestions appreciated! SELECT lngEid, dtmApptDate, Subject, Appt_ID FROM qry002 WHERE (dtmApptDate BETWEEN DateAdd("d",-weekday()+2,) And...
5
by: Peter Bailey | last post by:
I have a query that returns , and : 12/05/04 3 Wednesday 13/05/04 0 Thursday and so on what I would like to do now is count the number of bookings by week so from monday to...
9
by: Ray | last post by:
I need to convert the normal calendar to show the week no., the period no. and the financial year. The financial year format is as follows:- Date start: 2 May, 2005 7 days a week, 4 weeks a...
3
by: Steph. | last post by:
Hi, When I use the "Calendar.GetWeekOfYear" function (with "fr-BE" as CultureInfo and Monday as the first day of week) I get : Friday 31/12/2004 : week = 53
3
by: Mal | last post by:
Hello, Any advice on a function to convert a given week number to a date? Ideally I'd like the first day of that week. I'm using this to compare year to year....using the week number as the...
6
by: aarklon | last post by:
Hi folks, I found an algorithm for calculating the day of the week here:- http://www.faqs.org/faqs/calendars/faq/part1/index.html in the section titled 2.5 what day of the week was 2 august...
10
by: Jim | last post by:
I'm sure this has been asked before but I can't find any postings. I have a table that has weekly inspections for multiple buildings. What I need to do is break these down by the week of the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.