Results 1 to 5 of 5
  1. #1
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228

    Input Mask

    Based on a combo box choice (state/province), I am changing a zip-code textbox input mask to either reflect an American zip code, or a Canadian zip code. It does the job, however it does not show the "_" where characters are required unless I start typing or I click out of the textbox and then click back in. Then the mask appears.



    Is there a way to "reload" the text box after changing the input mask or something so that the mask appears when entered?

    Current Code:

    Code:
    Private Sub liststate_Exit(Cancel As Integer)Dim rs As Recordset
    
    
    If Nz(Me.liststate, "") <> "" Then
    
    
        Set rs = CurrentDb.OpenRecordset("SELECT [States].* FROM [States] WHERE((([States].State)='" & Me.liststate & "'));")
        
        With rs
            
            If .RecordCount > 0 Then
                
                If .Fields("Country") = "USA" Then
                    Me.txtzip.InputMask = "00000\-9999;;_"
                ElseIf .Fields("Country") = "Canada" Then
                    Me.txtzip.InputMask = "!>L0L 0L0;;"
                End If
                
            Else
                
                MsgBox "Error"
                
            End If
            
            .Close
            
        End With
        
    Else
    
        Me.txtzip.InputMask = ""
        
    End If
    
    
    If Not rs Is Nothing Then
        Set rs = Nothing
    End If
    
    
    End Sub
    I am just finding that regardless of changing the input mask or not, while tabbing in, it doesn't show the placeholders.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    The Canadian input mask doesn't have the parameter to show placeholders.

    Might instead try this code in the zip textbox GotFocus or OnEnter event.
    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
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    Same issue, it doesn't show the placeholders. I adjusted the Canadian to have them, that was my mistake.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Interesting, I never noticed before but I do have the same issue. Except the mask doesn't even show when typing or clicking. I built the code with assumption it would work. It compiled and I moved on. Never paid attention to the actual behavior. My textboxes are unbound - used to input filter criteria. Rats! Don't know how to fix.
    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.

  5. #5
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    It's an awkward issue, and it seems to happen whether you change the property or not. Tabbing into the textbox doesn't show the placeholders.... weird =/

    If anybody else has experience with this, please follow up.

    Thanks June7 for looking into this though.

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

Similar Threads

  1. Replies: 17
    Last Post: 04-14-2014, 11:44 AM
  2. Input mask
    By scorpion99 in forum Access
    Replies: 4
    Last Post: 02-21-2014, 02:18 AM
  3. input mask
    By slimjen in forum Forms
    Replies: 7
    Last Post: 10-07-2013, 03:20 PM
  4. Input Mask
    By qbc in forum Access
    Replies: 2
    Last Post: 01-20-2012, 03:27 PM
  5. Input mask
    By doobybug in forum Access
    Replies: 2
    Last Post: 06-17-2009, 09:40 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