473,473 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

RENEW DATE!

Greetings! I have a database in access that contains information
about the date members joined the company. Every year, membership
must be renewed for each member. Usually I will send out a standard
letter from a report to each member regardless of the date they
joined. Members are only supposed to receive letters an exact year
after they joined. I am wondering if it is possible for me to do a
setting that will let me to create reports and send letters that will
be a year from the exact date a member joined.
I will appreciate help in this

Regards,
L.S

Jul 6 '07 #1
2 1991
On Fri, 06 Jul 2007 07:29:13 -0700, La*******@gmail.com wrote:

I might want to print the letter only for those members where
MonthsMember Mod 12 = 0
Mod is the Modulo operator - see help file.

MonthsMember can be calculated with the DateDiff function:
DateDiff("m", DateJoined, Date())
This will give you the number of months that the person is a member.
I'm assuming DateJoined is the date field holding the date the person
became a member. Date() returns today's date.

Armed with the above you should be able to create the query for the
report.

-Tom.

>Greetings! I have a database in access that contains information
about the date members joined the company. Every year, membership
must be renewed for each member. Usually I will send out a standard
letter from a report to each member regardless of the date they
joined. Members are only supposed to receive letters an exact year
after they joined. I am wondering if it is possible for me to do a
setting that will let me to create reports and send letters that will
be a year from the exact date a member joined.
I will appreciate help in this

Regards,
L.S
Jul 6 '07 #2

<La*******@gmail.comwrote in message
news:11**********************@o61g2000hsh.googlegr oups.com...
Greetings! I have a database in access that contains information
about the date members joined the company. Every year, membership
must be renewed for each member. Usually I will send out a standard
letter from a report to each member regardless of the date they
joined. Members are only supposed to receive letters an exact year
after they joined. I am wondering if it is possible for me to do a
setting that will let me to create reports and send letters that will
be a year from the exact date a member joined.
The following code appears to accurately calculate the next occurrence of a
recurring date... see the comments for details. You could use it in a Query
and set Criteria using today's Date and the DateAdd function to set a
"window" in which dates would qualify for selection. You might want a
report of all memberships which will need to be renewed within the next 15
days, or 30 days, or other time period for a mailing (or e-mailing).

It has error code, which you may want to change, and has been "lightly
tested" for a demonstration, but not "rigorously tested" as for production.
Written and tested in Access 2003. Use it at your own risk...

Function NextOccurrenceOfDate(pdatDate As Date) As Date
'---------------------------------------------------------------------------------------
' Procedure : NextOccurrenceOfDate
' DateTime : 6/15/2007 23:25
' Author : LARRY LINSON
' Purpose : To calculate next occurrence of a recurring date, e.g.,
' a birthday, anniversary, etc.
' If month and day are less than current date, then the
' next occurrence is next year
' If month and day are equal to current date, this is "next"
' If month and day are greater than current date, then the
' next occurrence is this year
'---------------------------------------------------------------------------------------
'
On Error GoTo PROC_Error
Dim intMonth As Integer
Dim intDay As Integer
Dim intYear As Integer

intMonth = Month(pdatDate)
intDay = Day(pdatDate)
intYear = Year(pdatDate)

If intMonth = Month(Date) Then 'This month, so must test day
If intDay = Day(Date) Then 'Current/next occurrence is
today
NextOccurrenceOfDate = Date
ElseIf intDay Day(Date) Then 'Day is yet to come -- this year
NextOccurrenceOfDate = DateSerial(Year(Date), intMonth, intDay)
Else 'Day is past -- next year
NextOccurrenceOfDate = DateSerial(Year(Date) + 1, intMonth,
intDay)
End If
ElseIf intMonth Month(Date) Then 'Month still to occur this year
NextOccurrenceOfDate = DateSerial(Year(Date), intMonth, intDay)
Else 'Month already occurred this
year
NextOccurrenceOfDate = DateSerial(Year(Date) + 1, intMonth, intDay)
End If

PROC_Exit:
Exit Function

PROC_Error:
On Error GoTo 0
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
NextOccurrenceOfDate of Module basMiscAndEtc"
Resume PROC_Exit:

End Function

Larry Linson
Microsoft Access MVP
Jul 7 '07 #3

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...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
3
by: captain | last post by:
Below is the sql for data with same date need to extract + or - 5 days data of same date also. How to also get data of + and - days related to same date. SELECT IM.Area, IM.Location,...
2
by: A Traveler | last post by:
Hello, Given that a particular iis server has its session timeout set to the default of 20mins, what will renew the request in order to prevent it timing out? Is it only code-type things, such...
1
by: TheDude5B | last post by:
Hi, I was wondering if it is possible to manually renew the sessionID? I have had a look around and not found anything about renewing it automatically. I was wanting to do this just to...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
2
by: pedestrian via WebmasterKB.com | last post by:
I wonder is there any way I could renew the Session variables of ASP before it is expired? Thanks a lot. -- Message posted via WebmasterKB.com...
6
by: pradeep | last post by:
Hello friends: Say I allocate an array with a = new int(100); Later I want to grow the array to size 200. Do I need to allocate another array and copy the first one to it? Is there a simpler...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.