Discussion Locked

Microsoft Access DB Dates

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Ok, i am setting up a Microsoft Access Database in which i have a table that has a Name field (the primary key), a Start Date field, and an End Date field. I created a form that has all the three fields and a button that inserts the data into my table when i am done. Basically i take the start date and add 21 days to it. What i want access to do, is automatically advance the date by 21, (like =[date]+21) and have it insert that into the db when i am done. I dont care if i see this on the form. I haven't figure out how to do this. If someone here can simply tell me how to make it calculate the date and then insert that data into the db when i hit the button, i would be very happy. Thanks for any help you could provide.

-Matt Keller

3 replies

by kees.valkenswaard

It is not needed to make it complicated. Just add a default to SDate =now() and also to Edate =now()+21
That is all.
If you make a form you will see these default values right away.
NOTE You may wish to use =date().
You can protect the fields onthe form. That is all just to improve.
Make a table with the three fields and the two defaults. Make an auto form for the table and you will see it works. It took me one minute to check it.
[This typing costs me more time as I am still a lousy typist]
Good luck

by mattrk

Well, it's not that simple. The date is not just now, its a certain date that i enter.

I figured it out. All i did was in the after update event procedure of the Start Date, i setup an event procedure (vb) that read: [End Date] = [Start Date]+21. So after i enter a date in the Start Date field, it then updates the End date field adding 21 days to it. So, in the end it was a very simple answer. heh.

Thanks for your respons. I do appriciate it.

-Matt Keller

This discussion is closed to new replies.