Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

data format for field

Posted on 2002-04-08
6
Medium Priority
?
160 Views
Last Modified: 2010-05-02
Hello
how can a create fiekd in the form that will accept only data in specified format eg i would like to create field that will accept phone number in xxx-xxx-xxxx format

Thanks,
shri
0
Comment
Question by:shrihalbe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 5

Expert Comment

by:rkot2000
ID: 6926344
you should use masked control from microsoft.
0
 

Author Comment

by:shrihalbe
ID: 6926358
can you just explore that how can i used that one
i am really new in this feild.

thanks,
shri
0
 
LVL 5

Accepted Solution

by:
rkot2000 earned 120 total points
ID: 6926380
to add a control
menu : project-components -microsoft masked edit control.
drop a control on a form and press f1 for help. this is very simple control to use.


to clear masked control you should use this :

Public Sub ClearMaskEdBox(oMaskEdBox As MaskEdBox)
     Dim sTemp As String
     With oMaskEdBox
          sTemp = .Mask
          .Mask = ""
          .Text = ""
          .Mask = sTemp
     End With
End Sub

'Sample Call:
Private Sub cmdClear_Click()
     ClearMaskEdBox MaskEdBox1
     MaskEdBox1.SetFocus
End Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:aikimark
ID: 6926608
please be aware that you might want to explore third-party controls or add code to your masked edit control.  if the user presses the "-" character, they will not be repositioned to the start of the next series of SSN digits.
0
 
LVL 5

Expert Comment

by:KarcOrigin
ID: 6927120
Its simple,

You can use Mask edit control from microsoft.

Menu : Project- Components - Microsoft masked edit control

Add this code in Form Load -

Private Sub Form_Load()
    With MaskEdBox1
        .MaxLength = 12
        .Mask = "###-###-####"
    End With
End Sub


0
 

Author Comment

by:shrihalbe
ID: 6929593
thanks,
shri
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 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