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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

database design



 
 
Thread Tools Display Modes
  #1  
Old August 16th, 2004, 05:20 PM
Ian
external usenet poster
 
Posts: n/a
Default database design

I am trying to design a database which will store events which occur on the
same days every month for 6 months of the year and this obviously will not
be the same date.

I have some where in the region of 70 diferent organisations for which an
events diary is compiled every year, some have more than one event in one
month although the are on the same day but a different week.

It is a long leborious task changing dates every year and I am sure there
must be some way to do this using access.

Greatful for any help.

Ian


  #2  
Old August 16th, 2004, 08:14 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Mon, 16 Aug 2004 16:20:18 +0000 (UTC), "Ian"
wrote:

I am trying to design a database which will store events which occur on the
same days every month for 6 months of the year and this obviously will not
be the same date.

I have some where in the region of 70 diferent organisations for which an
events diary is compiled every year, some have more than one event in one
month although the are on the same day but a different week.

It is a long leborious task changing dates every year and I am sure there
must be some way to do this using access.


I'm not quite certain what you mean, but take a look at the DateSerial
and DateAdd functions. Open the VBA editor (by typing Ctrl-G for
example) and use the online help for these functions. Just as an
example, if you want to automatically store the 15th of July in the
current year, the function

DateSerial(Year(Date()), 7, 15)

will calculate it for you.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #3  
Old August 17th, 2004, 12:25 AM
rpw
external usenet poster
 
Posts: n/a
Default

Hi John,

This topic interests me also. I glanced at the help files and I don't
understand how to calculate the third Tuesday of every month (I think that's
similar to what Ian was asking for too).

I've used the immediate window and tried out some variations and here's what
I got:

DateAdd("m", 1, "17-Aug-2004") = 9/14/2004 which is a Friday.
DateAdd("ww", 4, "17-Aug-2004") = 9/14/2004 which is the second Tuesday
DateAdd("d", 28, "17-Aug-2004") = 9/14/2004 which is the second Tuesday

The third Tuesday of every month is a different interval each month -
sometimes it's five weeks, sometimes it's four weeks, so there must be
something else needed to get the result I want. Could you help me out with
that?

tia

rpw

"John Vinson" wrote:

On Mon, 16 Aug 2004 16:20:18 +0000 (UTC), "Ian"
wrote:

I am trying to design a database which will store events which occur on the
same days every month for 6 months of the year and this obviously will not
be the same date.

I have some where in the region of 70 diferent organisations for which an
events diary is compiled every year, some have more than one event in one
month although the are on the same day but a different week.

It is a long leborious task changing dates every year and I am sure there
must be some way to do this using access.


I'm not quite certain what you mean, but take a look at the DateSerial
and DateAdd functions. Open the VBA editor (by typing Ctrl-G for
example) and use the online help for these functions. Just as an
example, if you want to automatically store the 15th of July in the
current year, the function

DateSerial(Year(Date()), 7, 15)

will calculate it for you.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public

  #4  
Old August 17th, 2004, 05:30 AM
Cheval
external usenet poster
 
Posts: n/a
Default

Trythis function...

Function dhNthWeekday(dtmDate As Date, intN As Integer, _
intDOW As Integer) As Date
' Find the date of the specified day within the month.
For
' example, retrieve the 3rd Tuesday's date.
Dim dtmTemp As Date
If (intDOW vbSunday Or intDOW vbSaturday) _
Or (intN 1) Then
' Invalid parameter values. Just
' return the passed-in date.
dhNthWeekday = dtmDate
Exit Function
End If
' Get the first of the month.
dtmTemp = DateSerial(Year(dtmDate), Month(dtmDate), 1)
' Get to the first intDOW in the month.
Do While Weekday(dtmTemp) intDOW
dtmTemp = dtmTemp + 1
Loop
' Now you've found the first intDOW in the month.
' Just add 7 for each intN after that.
dhNthWeekday = dtmTemp + ((intN - 1) * 7)
End Function


-----Original Message-----
Hi John,

This topic interests me also. I glanced at the help

files and I don't
understand how to calculate the third Tuesday of every

month (I think that's
similar to what Ian was asking for too).

I've used the immediate window and tried out some

variations and here's what
I got:

DateAdd("m", 1, "17-Aug-2004") = 9/14/2004 which is a

Friday.
DateAdd("ww", 4, "17-Aug-2004") = 9/14/2004 which is the

second Tuesday
DateAdd("d", 28, "17-Aug-2004") = 9/14/2004 which is the

second Tuesday

The third Tuesday of every month is a different interval

each month -
sometimes it's five weeks, sometimes it's four weeks, so

there must be
something else needed to get the result I want. Could

you help me out with
that?

tia

rpw

"John Vinson" wrote:

On Mon, 16 Aug 2004 16:20:18 +0000 (UTC), "Ian"
wrote:

I am trying to design a database which will store

events which occur on the
same days every month for 6 months of the year and

this obviously will not
be the same date.

I have some where in the region of 70 diferent

organisations for which an
events diary is compiled every year, some have more

than one event in one
month although the are on the same day but a different

week.

It is a long leborious task changing dates every year

and I am sure there
must be some way to do this using access.


I'm not quite certain what you mean, but take a look at

the DateSerial
and DateAdd functions. Open the VBA editor (by typing

Ctrl-G for
example) and use the online help for these functions.

Just as an
example, if you want to automatically store the 15th of

July in the
current year, the function

DateSerial(Year(Date()), 7, 15)

will calculate it for you.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public

.

  #5  
Old August 17th, 2004, 07:03 PM
rpw
external usenet poster
 
Posts: n/a
Default

Hi Cheval,

Thank you for the function. I'm going to plug it into a module and
experiment with it until I get an understanding of how it's working. And
thank you for including explanitory comments in the function, that makes
understanding the function easier.

"Cheval" wrote:

Trythis function...

Function dhNthWeekday(dtmDate As Date, intN As Integer, _
intDOW As Integer) As Date
' Find the date of the specified day within the month.
For
' example, retrieve the 3rd Tuesday's date.
Dim dtmTemp As Date
If (intDOW vbSunday Or intDOW vbSaturday) _
Or (intN 1) Then
' Invalid parameter values. Just
' return the passed-in date.
dhNthWeekday = dtmDate
Exit Function
End If
' Get the first of the month.
dtmTemp = DateSerial(Year(dtmDate), Month(dtmDate), 1)
' Get to the first intDOW in the month.
Do While Weekday(dtmTemp) intDOW
dtmTemp = dtmTemp + 1
Loop
' Now you've found the first intDOW in the month.
' Just add 7 for each intN after that.
dhNthWeekday = dtmTemp + ((intN - 1) * 7)
End Function


-----Original Message-----
Hi John,

This topic interests me also. I glanced at the help

files and I don't
understand how to calculate the third Tuesday of every

month (I think that's
similar to what Ian was asking for too).

I've used the immediate window and tried out some

variations and here's what
I got:

DateAdd("m", 1, "17-Aug-2004") = 9/14/2004 which is a

Friday.
DateAdd("ww", 4, "17-Aug-2004") = 9/14/2004 which is the

second Tuesday
DateAdd("d", 28, "17-Aug-2004") = 9/14/2004 which is the

second Tuesday

The third Tuesday of every month is a different interval

each month -
sometimes it's five weeks, sometimes it's four weeks, so

there must be
something else needed to get the result I want. Could

you help me out with
that?

tia

rpw

"John Vinson" wrote:

On Mon, 16 Aug 2004 16:20:18 +0000 (UTC), "Ian"
wrote:

I am trying to design a database which will store

events which occur on the
same days every month for 6 months of the year and

this obviously will not
be the same date.

I have some where in the region of 70 diferent

organisations for which an
events diary is compiled every year, some have more

than one event in one
month although the are on the same day but a different

week.

It is a long leborious task changing dates every year

and I am sure there
must be some way to do this using access.

I'm not quite certain what you mean, but take a look at

the DateSerial
and DateAdd functions. Open the VBA editor (by typing

Ctrl-G for
example) and use the online help for these functions.

Just as an
example, if you want to automatically store the 15th of

July in the
current year, the function

DateSerial(Year(Date()), 7, 15)

will calculate it for you.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public

.


  #6  
Old August 17th, 2004, 10:34 PM
Ian
external usenet poster
 
Posts: n/a
Default

hi all

I am stil in trouble with this most obviously due to my lack of knowledge.

Not to sure what to do with the function or how to get it to work for me.

need more help.
"Ian" wrote in message
...
I am trying to design a database which will store events which occur on

the
same days every month for 6 months of the year and this obviously will not
be the same date.

I have some where in the region of 70 diferent organisations for which an
events diary is compiled every year, some have more than one event in one
month although the are on the same day but a different week.

It is a long leborious task changing dates every year and I am sure there
must be some way to do this using access.

Greatful for any help.

Ian




  #7  
Old August 18th, 2004, 01:55 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Tue, 17 Aug 2004 21:34:44 +0000 (UTC), "Ian"
wrote:

hi all

I am stil in trouble with this most obviously due to my lack of knowledge.

Not to sure what to do with the function or how to get it to work for me.


Ian, part of the problem is that you have not clearly stated just what
you are trying to accomplish. You say:

I have some where in the region of 70 diferent organisations for
which an events diary is compiled every year, some have more than one
event in one month although the are on the same day but a different
week.

You certainly know what you mean by "on the same day but a different
week", but I for one do not.

Could you post an example of the types of dates you want?

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Window Gone DaveB General Discussion 2 July 29th, 2004 12:24 AM
You do not have exclusive access... ERROR Robin General Discussion 1 July 6th, 2004 01:18 AM
Form Design with tracking into database Alicat21 Worksheet Functions 1 June 10th, 2004 12:00 AM
How do I design a database based on the information that will be stored? - Copy of Tables and hirearchies.zip (0/1) Jim Database Design 1 June 1st, 2004 01:44 PM
database design basic help als0107 Database Design 3 May 6th, 2004 07:26 PM


All times are GMT +1. The time now is 10:32 AM.


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