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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default: previous month

Status
Not open for further replies.

DLSE

Technical User
Sep 5, 2002
24
0
0
US
How do I set the default in a form to the previous month? This question probably has a very easy and obvious answer, but I'm new to access and couldnt find it in Microsoft's help files.
Thanks,
Matt
 
=Dateadd("m",-1,Date())

That will be one month prior to todays date. I.e. today is 6/10/2003 and that will return 5/10/2003.

Depending on your needs you may be interested in Cdate, dateserial, month, year, day and now functions.
 
MsgBox Month(Date - Day(Date))

Subtracting current date days from current date will give you the last day of the previous month which the month function then extracts for you.

Good Luck!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top