Setting fields to automatically fill in a date.

G

Guest

Is there a way that I can get a field to automatically fill in a date based
on another date field? I need something that can track when visits are due;
if I put in today's date, I would like 3 more dates to pop-up to give me 4
quarterly dates.
Please be as detailed as possible in your answer as I am still relatively
new to some of the features and functions of Access.

Thanks!
 
S

strive4peace

Hi Artemis,

yes,

create the controls on your form to store the other dates

on the AfterUpdate event of the source date, you can do something like this:

'~~~~~~~~~~~~~~~~~~~~~
if isnull(me.activecontrol) then exit sub

me.date1 = DateAdd("q", 1, me.activecontrol)
me.date2 = DateAdd("q", 2, me.activecontrol)
me.date3 = DateAdd("q", 3, me.activecontrol)
me.date4 = DateAdd("q", 4, me.activecontrol)
'~~~~~~~~~~~~~~~~~~~~~

where date1, date2, date3, and date4 corresponds to the the controlnames
of your first, second, third, and fourth quarterly dates

'~~~~~~~~~~~~~~~~~~~~~
from Help:

DateAdd(interval, number, date)

The DateAdd function syntax has these named arguments:

interval
Required. String expression that is the interval of time you want to add.

number
Required. Numeric expression that is the number of intervals you want to
add. It can be positive (to get dates in the future) or negative (to get
dates in the past).

date
Required. Variant (Date) or literal representing date to which the
interval is added.
'~~~~~~~~~~~~~~~~~~~~~


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
G

Guest

I think that worked, thank you so much!!!

strive4peace said:
Hi Artemis,

yes,

create the controls on your form to store the other dates

on the AfterUpdate event of the source date, you can do something like this:

'~~~~~~~~~~~~~~~~~~~~~
if isnull(me.activecontrol) then exit sub

me.date1 = DateAdd("q", 1, me.activecontrol)
me.date2 = DateAdd("q", 2, me.activecontrol)
me.date3 = DateAdd("q", 3, me.activecontrol)
me.date4 = DateAdd("q", 4, me.activecontrol)
'~~~~~~~~~~~~~~~~~~~~~

where date1, date2, date3, and date4 corresponds to the the controlnames
of your first, second, third, and fourth quarterly dates

'~~~~~~~~~~~~~~~~~~~~~
from Help:

DateAdd(interval, number, date)

The DateAdd function syntax has these named arguments:

interval
Required. String expression that is the interval of time you want to add.

number
Required. Numeric expression that is the number of intervals you want to
add. It can be positive (to get dates in the future) or negative (to get
dates in the past).

date
Required. Variant (Date) or literal representing date to which the
interval is added.
'~~~~~~~~~~~~~~~~~~~~~


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
S

strive4peace

you're welcome, Artemis ;) happy to help

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top