Solved

A formatted text box

Posted on 1998-06-09
2
134 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now