Results 1 to 3 of 3
  1. #1
    LindaRuble is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    63

    Press Alt key to disable date-checking code in program

    Hello,



    I want to be able to disable some date-checking code while entering a date for a control while the "ALT" key is held down. Normally I would want the user to only be able to input Today's date. A message will pop-up if the date entered is either before or after the current day. I want to use something like KeyCode so that I can bypass the date-checking code and enter any date I wish.

    This is kind of what I would like but I need some help with the KeyCode part.
    Any help would be appreciated.

    Thanks


    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++


    If (KeyCode = 18) Then ' KeyDown Alt

    'Nothing

    Else

    If (Me.Cut.Value < Date) Then
    MsgBox "A past date is not valid. " & vbNewLine & "Please enter today's date."
    Cancel = True
    ElseIf (Me.Cut.Value > Date) Then
    MsgBox "A future date is not valid. " & vbNewLine & "Please enter today's date."
    Cancel = True
    Else
    'Nothing
    End If

    End If

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    You need to trap the Alt key press. Does this help http://bytes.com/topic/access/answer...g-ctrl-alt-key
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Is this a situation where you only want an 'authorized user' to be able to edit the date? Or do you want this ability for any/all users?

    Linq ;0)>

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

Similar Threads

  1. checking date when recordcount > 0
    By JeroenMioch in forum Programming
    Replies: 14
    Last Post: 03-05-2013, 12:39 PM
  2. Can't disable source checking
    By chrisleng in forum Access
    Replies: 5
    Last Post: 10-17-2012, 12:03 PM
  3. Replies: 1
    Last Post: 12-07-2011, 01:02 PM
  4. Replies: 0
    Last Post: 11-22-2011, 09:10 PM
  5. Date error checking
    By oediaz in forum Programming
    Replies: 2
    Last Post: 03-26-2010, 12:08 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