Results 1 to 5 of 5
  1. #1
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    111

    Input Mask Violation Code Not Recgonizing Time Field

    I have the following code that is working for my ItemA and ItemB fields but not for my TimePur field.



    The ItemA and ItemB are numbers formatted: 0000 (4 numbers exactly in length)

    TimePur is Short Time format: 00:00;0

    The text boxes are bound to a single table. The formatting declarations are in both the table and in the respective property boxes.

    When I enter the wrong value in the ItemA or ItemB textbox, the appropriate error message shows up.

    When I enter the wrong time, the system's default error message displays. The ActiveControl.Name in the debug window does NOT display which tells me that the condition is not even being met. So my question is this: is the input mask violation error message for a time field something different than 2279? If so, how do I go about determining what it is?

    Access 2010

    Code:
    Private Sub Form_Error(DataErr As Integer, Response As Integer)
    Const INPUTMASK_VIOLATION = 2279
    Dim Msg As String
    If DataErr = INPUTMASK_VIOLATION Then
        Debug.Print Screen.ActiveControl.Name
        Select Case Screen.ActiveControl.Name
            Case "TimePur"
                Beep
                MsgBox "The time you entered is invalid!"
            Case "ItemA", "ItemB"
                Beep
                MsgBox "The Item value you entered is invalid!"
                Screen.ActiveControl.Value = ""
            Case Else
                Beep
                Msg = "An input mask violation occurred in control "
                MsgBox Msg & Screen.ActiveControl.Name & "!"
        End Select
        Response = acDataErrContinue
    End If
    End Sub
    Many thanks

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    for input masks you say

    TimePur is Short Time format: 00:00;0


    however short time format is 00:00

  3. #3
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    111
    I had it both ways. It didn't seem to make any difference. I just figured it out. Apparently the error code for time is 2113. Go figure.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    is the input mask violation error message for a time field something different than 2279? If so, how do I go about determining what it is?

    try debug.print err.number

  5. #5
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    111
    "debug.print err.number" did not work with my code; however "Debug.Print DataErr" did. Thanks. That piece of information will prove to be invaluable to me.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-01-2015, 02:57 AM
  2. Time Input mask - arrgh!
    By Sheba in forum Forms
    Replies: 1
    Last Post: 09-16-2014, 01:43 PM
  3. Double Input mask for data field
    By Pippolo in forum Access
    Replies: 1
    Last Post: 06-30-2014, 12:28 PM
  4. Replies: 17
    Last Post: 04-14-2014, 11:44 AM
  5. UK Postcode/ZIP Code Input Mask
    By tsn.s in forum Access
    Replies: 1
    Last Post: 04-02-2012, 05:49 AM

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