Adding days to the value in a date field

jim_blandford

Registered User.
Local time
Today, 13:52
Joined
Apr 15, 2003
Messages
13
Not sure whether this question is form related, but anyway...

I'm a complete novice on Access, and I've been making my first database for a sheep breeder for my GCSE ICT project in Access 2000. I couldn't find out how to do what I wanted so I thought I'd try here...

I have a field, 'Date tupped', the date the ewe was made pregnant by a ram. I want 147 days to be added to this date, and then that date to pasted in another field, 'Date due to lamb'. How can I do this? If there is a way to do this, will the value show in both the form and the table view?

Any help would be very much appreciated.
Thank-you in advance,

Jamie.
 
First point - you don't need to store the date you expect the lamb after the ewe has been 'tupped' as you can calculate it any time within a query.

On the AfterUpdate() event of your 'date tupped' field you would put the code in the form's module:

txtDateToLamb = DateAdd("d", 147, Me.txtDateTupped)
 
You could also do it without the code and set the textbox control source to = DateAdd("d", 147,[DateTupped])
 
Thanks guys, you lot are real experts!

The date appears in the Short date format, (15/4/03) but I need it in the Medium date format, (15-Apr-03). It does this evening though the 'Date due to lamb' field is set as a Medium date.
 
Which have you set to Medium Date format? The textbox or the field?
 
The field is in the table/query.

The textbox is a control that is bound to the field.

Change the format on the tetbox too.
 
Ah, sorry I wasn't looking in the right place for that...

Thank-you all very much for your help. It's working perfectly now :D

This forum is amazing, I got a reply within 10 minutes. And its all free :D
 
The boys will be around later...start counting the cash.
 

Users who are viewing this thread

Back
Top Bottom