Page 1 of 1

[Solved] Current Date as default date

Posted: Wed Feb 02, 2011 5:19 am
by tiredtraveler
IN a form I created I want my Date field to automatically show the current date as the default date when creating a new record. I saw SQL code how to get current date but could not find a location in the date fields property box. What am I missing??? I know it must be simple.

Thanks in advance.
Bob

Re: Current Date as default date

Posted: Wed Feb 02, 2011 5:58 pm
by Villeroy
No, it is not simple. Base can not hanlde any dynamic defaults such as current date, time nor user name. You need some macro which puts a valid value into the field when the form inserts a new record. But Base macros cause more pain than relief unless you are a fairly proficient programmer.
Normally, I do not show any fields with automatic content. If the user is allowed to override the default value, I add some label like "Date (Default: Today)".

Re: Current Date as default date

Posted: Wed Feb 02, 2011 7:26 pm
by tiredtraveler
Thank you. Glad I asked before spending a long time on it. No, I am not a proficient programmer.

Any chance "current_date" would be/could be an option in some future release?

Re: (Resolved) Current Date as default date

Posted: Wed Feb 02, 2011 8:56 pm
by Arineckaig
Any chance "current_date" would be/could be an option in some future release?
Meanwhile you may find it helps to use a Date Field form control in your form that can be given a "Drop down" property. When selected a calendar for the current month is displayed together with a button for selecting today's date. Other dates can be just as easily selected.