Results 1 to 13 of 13
  1. #1
    jsaren is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    6

    Date() = Today's date (ACCESS 2010) doesn't work




    This is weird. I have had an Access db since 2000 and the default date of today has always worked in a specific date field.

    Dues Paid Date: (should default to today).

    It did, It does in 2007, but it doesn't in 2010.

    no errors default =Date().

    Just that the form does not display today's date. It takes a manual date, but it should display today's date.

    any ideas? Any VBA code I could do to mitigate this problem.

    Joel

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I'm using Access 2010.

    I just put a Text Box on a Form and for the Control Source I put
    Code:
     = Date()
    When I ran the form - it displayed today's date.

    Where are you using the 'Date()' function?
    Is it on a control on a Form . . . or is it in a Query?

  3. #3
    jsaren is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    6
    I tried to replace the Dues Paid Date TXT box with a new txt box with Default = date()
    Still nothing.
    So I tried, VBA DUES_PAID_DATE = NULL thinking that they maybe some old stuff in there.
    Still no success.

  4. #4
    CraigDolphin is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Apr 2009
    Location
    Custer, WA, USA
    Posts
    125
    This is a bit weird. And when I see weird I try the following steps:

    1. Make sure you don't have any controls or fields that are named using reserved words (http://support.microsoft.com/kb/286335) or that use un-escaped special characters (spaces, symbols etc)
    2. Compile the db and eliminate any vba errors that may prevent the db code compiling correctly. From the VBA editor>Debug>Compile
    3. Check for broken references. From the VBA editor>Tools>References and look for any that are checked with the word 'MISSING'. Uncheck any that are missing and replace with the equivalenbt compatible library reference in the list or rework code to avoid using the missing library. You might need to reinstall access if you can't avoid using a reference library and it has been somehow deleted from your machine.
    4. Compact and repair the database.
    5. (Last resort) If the date function works in a new database file, but not in your existing file, and you've exhausted the other steps I've mentioned, then it could be a database corruption has occured. In this case, try importing all of your database objects (tables/queries/forms etc) into a clean new db file in case corruption is creeping into your existing db file. Before importing forms, however, import all the rest of the objects first and test with a clean blank form to be sure that date function is working correctly. If it works before importing the forms, but breaks afterwards, then you may have corruption in one of your forms. If so, bring them in one by one and keep testing. When the corrupted form has been identified, start over and import everything except the corrupt form. Then rebuild the corrupt form from scratch in the new database file.

    HTH

  5. #5
    jsaren is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    6
    1. Make sure you don't have any controls or fields that are named using reserved words (http://support.microsoft.com/kb/286335) or that use un-escaped special characters (spaces, symbols etc)

    >>> none there.

    2. Compile the db and eliminate any vba errors that may prevent the db code compiling correctly. From the VBA editor>Debug>Compile

    >>>> compiled, no errors

    3. Check for broken references. From the VBA editor>Tools>References and look for any that are checked with the word 'MISSING'. Uncheck any that are missing and replace with the equivalenbt compatible library reference in the list or rework code to avoid using the missing library. You might need to reinstall access if you can't avoid using a reference library and it has been somehow deleted from your machine.

    >>> nothing "missing"

    4. Compact and repair the database.

    >>>> did that, no differences.

    5. (Last resort) If the date function works in a new database file, but not in your existing file, and you've exhausted the other steps I've mentioned, then it could be a database corruption has occured. In this case, try importing all of your database objects (tables/queries/forms etc) into a clean new db file in case corruption is creeping into your existing db file. Before importing forms, however, import all the rest of the objects first and test with a clean blank form to be sure that date function is working correctly. If it works before importing the forms, but breaks afterwards, then you may have corruption in one of your forms. If so, bring them in one by one and keep testing. When the corrupted form has been identified, start over and import everything except the corrupt form. Then rebuild the corrupt form from scratch in the new database file.

    Oh Mann, that would the last resort. For now, I've just taken out the Format 00/00/00 and let the calendar pop up.

  6. #6
    CraigDolphin is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Apr 2009
    Location
    Custer, WA, USA
    Posts
    125
    Hmm. Well, reinstalling access might be worth trying. But if it is a corruption of your form then you should do something about it. Corruption tends to grow if not rooted out, as I understand it. And if your database is not split, then over time you could end up having the the data tables become corrupted as well. And that is something that you really, really don't want to have happen...

    Does the function work correctly in a brand new db file?

  7. #7
    jsaren is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    6
    The problem is on my desktop and not on my laptop. Ouch. Now, That's scary. Corruption may be an issue. I will look into that.

    Thanks all for the feedback.

  8. #8
    jsaren is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    6
    very interesting. My laptop Access database is fine. March 6, 2011 instance of the db on my laptop works fine. March 6, 2011 instance of the db on my desktop does not. I will try reinstalling Access 2010 on my desktop, and see if anything changes.

    Just confirmed that the 11/9/11 db on my desktop works fine when I copy the db to my laptop. I guess it is not an Access issue, but (I hope) an install problem and a fresh install will resolve the problem.

  9. #9
    jsaren is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    6
    The reinstall resulted in the exact same results. I think I need to phone MS Access support.

  10. #10
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    You may want to check you regional/language settings.

    If your desktop is set to (let's say) Hungarian and your laptop uses (let's say) English Regional settings, then you can run into problems because those two Regions format their dates differently.

  11. #11
    Jtrevat is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    1
    I've always used the NOW() function and just limited the control.

  12. #12
    QIZHIQIANG is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2012
    Posts
    2
    AGREE

  13. #13
    iProRyan is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2011
    Location
    England, United Kingdom
    Posts
    44
    One method you could try to overcome this issue is to create two new text boxes, then right-click the form and goto "Form Properties" under the Event tab set the timer interval 1000 and set the on timer event to say

    Code:
    TextBox1Name = Now()
    TextBox2Name = Now()
    you can then set the properties of each textbox to be formatted to either Long Date as one and the other as Medium Time.

    Badly explained but hope this helps

Please reply to this thread with any new information or opinions.

Similar Threads

  1. OutputTo Macro Include today's date
    By Lorlai in forum Access
    Replies: 2
    Last Post: 09-27-2011, 01:42 PM
  2. Entering Today's Date
    By Alex Motilal in forum Access
    Replies: 5
    Last Post: 08-23-2011, 12:22 AM
  3. Replies: 4
    Last Post: 07-26-2011, 12:33 AM
  4. Set Calendar to default to today's date
    By RickM in forum Access
    Replies: 1
    Last Post: 02-22-2009, 04:51 AM
  5. query date that is five years older than today
    By cpsummer in forum Queries
    Replies: 2
    Last Post: 09-26-2007, 02:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums