Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date control and defaulting

Status
Not open for further replies.

xerox999

Technical User
Mar 11, 2003
50
GB
Hi all,

I have two fields on a form which need dates in them. In one of the dates I need it to be defaulted to todays date if nothing is entered manually, and the other date field i need to add on 10 days from todays date. Also is there a way to get a drop down calender control to fill in a field with a date?

Many Thanks to u all
 
Set the default to Date(). To get it to work properly you may have to go through the build option in the default property, rather than just typing Date() in.

In order to add 10 days use the DateAdd function. You can look it up for the specific syntax, but in order to add 10 days to the current date it would be something like this:

DateAdd("d",Date(),10)

 
BSman many thanks for your help. I just figured this way out:
used Default value as =Now().

Any ideas on how a calender control on the form can be used to populate the fields if needed also?


 
I think that using a calendar control is explained fairly well in the Access help. (I never use the calendar control myself, which is why I can't give you details.)

The difference between Now() and Date() is that Now() returns both the date and the time, so if you need the time along with the date, Now() is the correct one to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top