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

Insert current date into control - without the time

Status
Not open for further replies.

MrJRW

IS-IT--Management
Feb 6, 2002
47
US
In a data entry form, I would like to have a control with the default value be =Now() WITHOUT the time stamp. =Date() gives a #Name? result.

The control source is a field defined as a short date.

Any ideas ?

Thanks
 
"=Date()" should work--it does for me. Perhaps you have a field or control named "Date"? That can cause a #Name? error. It's best to avoid using names of built-in properties and functions when naming tables, fields, forms, and controls. "Name" and "Date" are the most common problems with this, since they're such obvious names.

If you can't rename the field or control, try using the expression "=CDate(Int(Now()))". Int(Now()) extracts the Integer part of the current date and time, which is the date part. You then have to convert it back to a datetime value. Rick Sprague
 
Thank-you for all your help
CDate(Int(Now())) was the way to go !

MrJRW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top