Results 1 to 6 of 6
  1. #1
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126

    Issue with Date Entry using ctrl:

    I am unable to enter the current date using "ctrl:".



    I get a message 'The expression you entered has a function name that Microsoft Access can't find'.

    Also other functions such as formating a date do not work.

    A List box just shows blank.
    Code:
    SELECT ItemID, EventDay, Format([EventDay],"h:nn a/p"), Display FROM CalendarQDisplay WHERE EventDay>=Date()+1 AND EventDay<=Date()+2;
    This started after I had to reinstall Access following a computer issue, and it only affects 1 database on my computer. Other databases work fine.

    Ahy thoughts?

    Jim O

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    First of all, I didn't know the Ctrl: shortcut for inputting the current date so thank you for that.

    As the Date function is part of the default Visual Basic for Applications ref library which can't be deleted, this makes little sense.
    Have you tried typing ?Date or ?Date() into the VBE Immediate window to check if that works?

    Have you tried compiling your database?

    Sounds to me like one of the following are true
    a) You have defined Date as a variable somewhere in your database
    Search for Dim Date As ... or Public Date As ... Or Global Date As ... and if any of these exist delete them
    Then compile your database and check your code again

    b) If that doesn't fix it, then you have corruption somewhere.
    DECOMPILE your database, then RECOMPILE then COMPACT
    For info on decompiling, see http://www.fmsinc.com/microsoftacces.../decompile.asp

    Otherwise, I would say, reinstall Access ... but you say its only the one database with an issue
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,861
    Shouldnt there be an "As" in there? Format([EventDay],"h:nn a\p") As Something

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Umm, I think I'd turn on "break on all errors" and figure out which line of code raises the error unless you already know. I don't see how a shortcut for entering a value would raise such an error any more than typing it in or selecting from the built in calendar control. To me, there is not enough info, like whether or not there is any code behind the form control, or exactly when the error is raised (after it loses focus? Immediately upon Ctrl+: keypress?).

    IIRC, this error can be raised when a field is mis-named (EvntDay instead of EventDay, for example). Access can/will assume it's a function call; probably because it's not part of a table.field syntax ( tblMyTable.EventDay or even just because there's no brackets to flag it as a field or domain name [EventDay]).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    Oops.
    I misread the thread as the problem is with Format(Date...) rather than Date().
    Much of my post still applies however.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #6
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126
    My skills are lacking to try some of what has been suggested, but I thank everyone for the input.

    I have resorted to exporting the offending data to a new database (on the same computer) and the files all seem to function as required. I have no idea what has caused this one database to act up. I even tried to open a new test table, but the date entry still will not work (ctrl. This is a database I use for personal use so time is on my side.

    Again thanks to all for the input and if I run into any other issues will keep you posted.
    Jim O

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

Similar Threads

  1. Date entry issue on form...
    By willmafingerdo in forum Access
    Replies: 15
    Last Post: 08-30-2016, 09:09 AM
  2. Very Strange subform data entry issue
    By RayMilhon in forum Forms
    Replies: 3
    Last Post: 06-05-2015, 10:46 AM
  3. Print reports in a tab ctrl in a tab ctrl
    By marcsessoms in forum Reports
    Replies: 1
    Last Post: 02-18-2012, 12:15 AM
  4. Help with a form data entry issue
    By kcm4491 in forum Forms
    Replies: 3
    Last Post: 11-19-2010, 12:00 AM
  5. Subform Data Entry Issue
    By yuriyl in forum Forms
    Replies: 3
    Last Post: 05-14-2009, 08:49 PM

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