If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
dafault value for date not working with Date() but Now() is workin
Got a table with existing data, with simple date field on a form that I want
to default to todays date. I have tried inputting the Date() into the table default value for the date, but I get an error that says "Unknown function in 'Date' in validation expression or default value on 'Data.date'. Data is the table name. If I enter Now() into the default value for date, it works just fine. But, the reports that are generated, don't show the records with the date and time in them. I can go back to the table and manually delete the time from those records, and they then show up in the report. Any ideas? I just want to use the default date of today in the date field. |
#2
|
|||
|
|||
dafault value for date not working with Date() but Now() is workin
The correct usage in Access is Now(). Date is a reserved word and really
shouldn't be used for a field name. Try changing it if possible. Bonnie http://www.dataplus-svc.com Dirty70Bird wrote: Got a table with existing data, with simple date field on a form that I want to default to todays date. I have tried inputting the Date() into the table default value for the date, but I get an error that says "Unknown function in 'Date' in validation expression or default value on 'Data.date'. Data is the table name. If I enter Now() into the default value for date, it works just fine. But, the reports that are generated, don't show the records with the date and time in them. I can go back to the table and manually delete the time from those records, and they then show up in the report. Any ideas? I just want to use the default date of today in the date field. -- Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
dafault value for date not working with Date() but Now() is workin
On Fri, 26 Feb 2010 13:20:01 -0800, Dirty70Bird
wrote: Got a table with existing data, with simple date field on a form that I want to default to todays date. I have tried inputting the Date() into the table default value for the date, but I get an error that says "Unknown function in 'Date' in validation expression or default value on 'Data.date'. Data is the table name. If I enter Now() into the default value for date, it works just fine. But, the reports that are generated, don't show the records with the date and time in them. I can go back to the table and manually delete the time from those records, and they then show up in the report. Any ideas? I just want to use the default date of today in the date field. Two possible issues: first, is your fieldname Date? If so, you're getting Access confused about whether you mean the fieldname or the builtin Date() function. Avoid using reserved words like this as the names of fields or controls. Second, if that's not it, you may have a bad reference. Date() seems to be especially vulnerable to this. To see, open any module in design view, or open the VBA editor by typing Ctrl-G. Select Tools... References from the menu. One of the .DLL files required by Access will probably be marked MISSING. Uncheck it, recheck it, close and open Access. If none are MISSING, check any reference; close and open Access; then uncheck it again. This will force Access to relink the libraries. -- John W. Vinson [MVP] |
#4
|
|||
|
|||
dafault value for date not working with Date() but Now() is workin
On Fri, 26 Feb 2010 22:25:19 GMT, "bhicks11 via AccessMonster.com"
u44327@uwe wrote: The correct usage in Access is Now(). Well... not really. There is a Now() function which returns the current date and time accurate to the second; there is *also* a Date() function which returns the current date without a time portion (equivalent to midnight at the start of today's date). Both functions have their uses, just depending on whether you want the time included or not. You're quite right about not using Date as a fieldname, though. -- John W. Vinson [MVP] |
#5
|
|||
|
|||
dafault value for date not working with Date() but Now() is workin
Oh Johnny - I should have known you'd catch me!
John W. Vinson wrote: The correct usage in Access is Now(). Well... not really. There is a Now() function which returns the current date and time accurate to the second; there is *also* a Date() function which returns the current date without a time portion (equivalent to midnight at the start of today's date). Both functions have their uses, just depending on whether you want the time included or not. You're quite right about not using Date as a fieldname, though. -- Message posted via http://www.accessmonster.com |
#6
|
|||
|
|||
dafault value for date not working with Date() but Now() is wo
changed the field name from "date" to "dates", still same error message. I
also changed it from "date" to "chris" (my name), still same error message. tools, references, shows "admin 1.0 type library" was missing. Unchecked, then re-checked, closed access, re-added the date(), still same error message. Then re-opened access, unchecked the "admin 1.0 type library" check box, saved, then exited. Re-added the date(), now no error messages are present. Appears to work without this "admin 1.0 type library"... "John W. Vinson" wrote: On Fri, 26 Feb 2010 13:20:01 -0800, Dirty70Bird wrote: Got a table with existing data, with simple date field on a form that I want to default to todays date. I have tried inputting the Date() into the table default value for the date, but I get an error that says "Unknown function in 'Date' in validation expression or default value on 'Data.date'. Data is the table name. If I enter Now() into the default value for date, it works just fine. But, the reports that are generated, don't show the records with the date and time in them. I can go back to the table and manually delete the time from those records, and they then show up in the report. Any ideas? I just want to use the default date of today in the date field. Two possible issues: first, is your fieldname Date? If so, you're getting Access confused about whether you mean the fieldname or the builtin Date() function. Avoid using reserved words like this as the names of fields or controls. Second, if that's not it, you may have a bad reference. Date() seems to be especially vulnerable to this. To see, open any module in design view, or open the VBA editor by typing Ctrl-G. Select Tools... References from the menu. One of the .DLL files required by Access will probably be marked MISSING. Uncheck it, recheck it, close and open Access. If none are MISSING, check any reference; close and open Access; then uncheck it again. This will force Access to relink the libraries. -- John W. Vinson [MVP] . |
Thread Tools | |
Display Modes | |
|
|