A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Find date



 
 
Thread Tools Display Modes
  #1  
Old May 29th, 2004, 07:34 PM
external usenet poster
 
Posts: n/a
Default Find date

Hi,

Can anyone help with this, please?

I have a date field [Arrival] which can be any date. What I'm looking
to do is change this date to the Monday of the THIRD week of the month
specified in [Arrival], unless this date has been passed, when I
require the date to be the Monday of the THIRD week of the following
month.

Can it be done?

dg



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #2  
Old May 29th, 2004, 08:44 PM
Ken Snell
external usenet poster
 
Posts: n/a
Default Find date

Define "third week". Is that the third Monday? The week that contains the
third Sunday? The third week that has a full seven days?


--
Ken Snell
MS ACCESS MVP

wrote in message
...
Hi,

Can anyone help with this, please?

I have a date field [Arrival] which can be any date. What I'm looking
to do is change this date to the Monday of the THIRD week of the month
specified in [Arrival], unless this date has been passed, when I
require the date to be the Monday of the THIRD week of the following
month.

Can it be done?

dg



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---


  #3  
Old May 30th, 2004, 12:27 PM
external usenet poster
 
Posts: n/a
Default Find date

On Sat, 29 May 2004 15:44:40 -0400, "Ken Snell"
wrote:

Define "third week". Is that the third Monday? The week that contains the
third Sunday? The third week that has a full seven days?


Ken,

Thanks for your interest:

Third week is third Monday

Ta

dg



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #4  
Old May 30th, 2004, 07:10 PM
Ken Snell
external usenet poster
 
Posts: n/a
Default Find date

Here is a single expression that will return the desired "third Monday"
date:

ThirdMonday = DateSerial(Year([Arrival]),
Month([Arrival])-(Day([Arrival])(22-DatePart("w",DateSerial(Year([Arrival])
,
Month([Arrival]),1),vbTuesday))),22-DatePart("w",DateSerial(Year([Arrival]),
Month([Arrival])-(Day([Arrival])(22-DatePart("w",DateSerial(Year([Arrival])
, Month([Arrival]),1),vbTuesday))),1),vbTuesday))


--
Ken Snell
MS ACCESS MVP

wrote in message
news
On Sat, 29 May 2004 15:44:40 -0400, "Ken Snell"
wrote:

Define "third week". Is that the third Monday? The week that contains the
third Sunday? The third week that has a full seven days?


Ken,

Thanks for your interest:

Third week is third Monday

Ta

dg



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---


  #5  
Old May 30th, 2004, 11:33 PM
external usenet poster
 
Posts: n/a
Default Find date

On Sun, 30 May 2004 14:10:31 -0400, "Ken Snell"
wrote:

Here is a single expression that will return the desired "third Monday"
date:

ThirdMonday = DateSerial(Year([Arrival]),
Month([Arrival])-(Day([Arrival])(22-DatePart("w",DateSerial(Year([Arrival])
,
Month([Arrival]),1),vbTuesday))),22-DatePart("w",DateSerial(Year([Arrival]),
Month([Arrival])-(Day([Arrival])(22-DatePart("w",DateSerial(Year([Arrival])
, Month([Arrival]),1),vbTuesday))),1),vbTuesday))


Ken,

Brilliant, thanks

dg



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #6  
Old May 31st, 2004, 04:31 PM
Hez
external usenet poster
 
Posts: n/a
Default Find date

Hey,

Actually the problem isnt quite hard...Access structures its dates uniquely i.e each week has a number (1-52). So just use a bunch of IF loops to check for every third week. Again, every date has a number (1 to 7) use DatePart() to check for Mondays(2). This will check the [Arrival] date.

Now to check if the date has passed, use the Date() function. and voila! Job Done.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.