Pre-Selected Date field

hkimpact

Registered User.
Local time
Today, 12:11
Joined
Apr 27, 2012
Messages
51
Good morning everyone. I have a question reguarding a pre-selected field.

Currently on my form I have a Start Date and also a End Date. After you enter the 2 dates then you can print the report that the form is set up for.

The textfield is set up to either allow you to type in the date or to click on the text field and allow you to select the calendar tool. How can I change the dates to dates I want when the form loads though? I don't necessarily want the year, but I always want to have a date range from 12/11 - 12/10.

Does that make sense? lol
 
Nevermind I figured it out myself. I ended up using the DateAdd function. To get a date I wanted I just used something like this...

DateAdd("m", 0, "12-Dec-2012")
 
Actually I went one step further with this if anyone ever needs an example.

So I needed a date range between 12/13/2011 and 12/12/2012. But each year this is going to change, so I wanted the year to update as well. The month and day will always be the same unless the State changes this for my company.

Start Date looks like this:
=DateAdd("m",0,"13-Dec-" & Year(Date())-1)

End Date looks like this:
=DateAdd("m",0,"12-Dec-" & Year(Date()))
 
I like DateSerial better, but whatever works for you.

Start date - =DateSerial(Year(Date())-1, 12, 13)
End date - DateSerial(Year(Date()), 12, 12)
 
I like DateSerial better, but whatever works for you.

Start date - =DateSerial(Year(Date())-1, 12, 13)
End date - DateSerial(Year(Date()), 12, 12)

I like that way a little better too. Thanks for sharing!
 

Users who are viewing this thread

Back
Top Bottom