Solved

A formatted text box

Posted on 1998-06-09
2
135 Views
Last Modified: 2010-05-03
I need a data-bound text box that shows DAO data from the JET engine formatted as required i.e format(foo,"###0.00").
I have tried to set the Access format value when designing the database but the values come back raw. The Masked Text control NEARLY works but is left formatted, I also need the ability to have the control locked when required.
0
Comment
Question by:entretec
2 Comments
 
LVL 2

Accepted Solution

by:
swilt earned 50 total points
ID: 1462872
Use a text box with Alignment set to 1 - Right Justify and the following piece of code

Private Sub Text1_Change()
    Static bInHere As Boolean
   
    If Not bInHere Then
        bInHere = True
        Text1.Text = Format$(Text1.Text, "#0.00")
        bInHere = False
    End If
End Sub


If you do Text1.Enabled = False this code still works
0
 

Author Comment

by:entretec
ID: 1462873
Thanks, what I was really looking for was a control  rather than having to put this code in every text box. However I suppose I could create a user-control.

Mike
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now