Solved

Stuffing a formated field

Posted on 2002-07-08
6
159 Views
Last Modified: 2010-05-02

I have a phone number field on a page with the custom format of (@@@) @@@-@@@@. It works fine when reading the data from the database. For instance if I have 5551231234 in the database then (555) 123-1234 is displayed. The problem is when I "stuff" the field with data. If I say txtMyPhone.text = "5551231234" then the text field just displays 5551231234 until I exit and come back into the form. If I stuff it with (555) 123-1234 then it displays properly until I exit the form and come back in. In which case I get something like ((55)5) -123-12.  How can I stuff the field and have it immediatly formated via the current fields format properties?
0
Comment
Question by:bfeddish
[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
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7137768
Instead of stuffing in a text Box, why don't you try writing it in another maskedit box with the same format.

So when you save it, wont that help.

-priya


0
 
LVL 1

Author Comment

by:bfeddish
ID: 7137824

After the user exits the field with a 7 digit number I put in the area code automatically and and I want the field to display to the user properly right after they exit the field.

Bryan
0
 
LVL 1

Expert Comment

by:eeevans
ID: 7137919
What particular edit control are you using.  The one I'm using won't take anything that isn't already formatted.

eeevans
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 1

Author Comment

by:bfeddish
ID: 7138051

Regular text box.
0
 
LVL 2

Accepted Solution

by:
priya_pbk earned 75 total points
ID: 7138415
hi bfeddish

I strongly recommend you to use "MaskEditBox". This is just what you require to accomplish your task.

Try doing the following: (I just tried it myself, created a database in Access and made a project in VB)

My table consists of the following:
Table Name:PhoneBook

Coln's:
id:AutoNumber datatype (primary key)
PhoneNumber:Text dataype

Put in 2 dummy records like (555) 123-6666 and (666) 444-2345

----------------------------

For the VB project. Add a Maskedit Box (Reference to Microsoft MaskEdit control 6.0 in Project->Components)and for the database thing, add an Adodc control and connect to your database table(here in my case phoneBook.mdb).

First of all you have gotta format the Maskeditbox. Click the MaskeditBox and press F4 for its properties.

1) Click the "Format" properties and copy this format:
(###) ###-#### or whatever format you wish to have and press enter.

2)Then set the 'Datasource' properties of the MaskEdit Box to 'Adodc1" and the 'DataField' properties to phoneNumber(in this case)

Now press F5 to execute the project to see the records of the database. You can change/edit the records at runtime with the format you wish to save.

I hope I have helped you to a certain extend!

-priya

0
 
LVL 1

Author Comment

by:bfeddish
ID: 7138538

That was it!

Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

739 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