Date default

SteveE

Registered User.
Local time
Today, 18:24
Joined
Dec 6, 2002
Messages
221
I have a date field formatted to short date which I need to default to today's date when adding new data. The problem I have is that =Date() is set as default but the value returned is #Name? not the date. If I use =Now() I get the date and time value BUT I only want the date.

any help please??

:confused:
 
The Date Function Requires 3 Parameters

Returns the serial number of a particular date.

Syntax

DATE(year,month,day)

Year is a number from 1900 to 9999.

Month is a number from 1 to 12 that represents the month of the year.

Day is a number from 1 to 31 that represents the day of the month.

The Now Function Simply Returns a Serial Number of Date/Time Format
 
ps...
If you want to get today's date use Today() instead of Now()
 
You have a missing reference problem, it's a question that's asked here so often, use the search here for answers on how to correct
 
Say What Rich??
I will yield if Today() is incorrect, but I am fairly sure that it should work.
 
Sorry to be a pain but, Today() gives same result, DATE(year,month,day) tells me "the expression you entered contains a function containing the wrong no of aurguments"
 
Just put =Date() as the default value, if that doesn't work then sort the Reference problem as suggested
 
Steve,
I believe you misunderstood the above post.
The DATE(year,month,day) worksheet function is not meant to return a value in and of itself.

If you were to use Date(param,param,param) you would need to input 3 parameters (year,month,day). Thus, this is probably not the function for you.

=Today(), however, requires no parameters and simply returns the current date. I'm betting that you left the "=" part out of the control source property and that's why you were still getting the error.
 
The Date function in Access is not the same as Excel, it requires no arguments, just =Date() or Date in vba, it returns a Variant (Date) containing the current system date.
 
Wierd...
I must be sucking in too many of the SUV fumes up here in the Pacific Northwest.

Steve,
You must be thoroughly confused by now.
 
Sorry to be a pain but I'v just tried it again =Today() returns #Name? as does =Date() or Date() without any other parm?

This happens when on my form, new record is selected and the date is my first entry field which is normally the current date. So to help user enter info quickley I wish it to default to the current date. If I use Now() the date is correct but it also includes the time. If later in the day I run the report using the date as the first critria then records donot appear as the critria entered is entered in the dd/mm/yy form without times?
thanks for all your help.

Steve
 
Rich is correct ..... you have a "Missing" library reference. This will cause Date(), Left(), Right(), Mid(), Trim() .... and many other common functions to error.

If you check the library references in the app on the offending machine ...... I think you will find the problem.

For more information see the link below:

How to Check Library References

HTH
RDH
 
Many thank for all your help it was a missing libray file which I have now replaced, all now works fine.

again
many thanks

Steve
 

Users who are viewing this thread

Back
Top Bottom