Solved

MaskEdBox - using with a custom mask

Posted on 2000-03-02
6
444 Views
Last Modified: 2013-12-26
Looking for an example of how to check data input of the "Canadian Postal Code" using this control.
0
Comment
Question by:trudymaresch
  • 3
  • 3
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2578595
Set the Mask property to: >?#? #?#
0
 

Author Comment

by:trudymaresch
ID: 2580729
Emoreau thanks for responding... Tried this mask.

ON lost focus event with "country" (the previous field) the maskedbox becomes visible and gets focus if the country=Canada.  I can type anything in the maskedbox1 and it will except it.  Isn't it supposed to check the format when entering in the data?  Does the maskedbox control have to be bound to an data control for it to work?

These are probably more than you wanted to answer.....

0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 100 total points
ID: 2580984
Are you setting the Format or the Mask property?

The mask property is for inputting while the format property is for displaying.

Here is a code sample that works for me:
Private Sub Text1_LostFocus()
    If UCase$(Trim$(Text1.Text)) = "CANADA" Then
        MaskEdBox1.Visible = True
        MaskEdBox1.Mask = ">?#? #?#"
        MaskEdBox1.SetFocus
    Else
        MaskEdBox1.Visible = False
    End If
End Sub
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2587388
Is it working for you now?
0
 

Author Comment

by:trudymaresch
ID: 2588825
Hi Emoreau,  I will be working on that project Thursday to make the change and I will let you know.  Its look good, but I have to try it where the project is located.  If you want to post you comment as the answer please do so.  If I have any other problems I will comment further on your answer.
0
 

Author Comment

by:trudymaresch
ID: 2602452
Thanks emoreau, your code worked wonderfully!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question