Decimal Problem

D

DS

I have this code that seemed to have worked and then stopped. If you
type in 1 you are suppose to get .01 in the TxtHidden field.
type in 11 it should be .11
type in 111 it should be 1.11
instead I'm getting ...
type in 1 I get 1.00
type in 11 I get 11.00
type in 111 I get 111.00

Any help appreciated.
Thanks
DS


'1 Button
Private Sub Image1_Click()
Me.LabelRate.Visible = False
Me.LabelDisplay.Visible = True
Me.TxtHidden = Me.TxtHidden & 1

Dim strX As String

Select Case Len(Trim(TxtHidden.Value))
Case 0
strX = "0"
Case 1
strX = ".0" & TxtHidden.Value
Case 2
strX = "." & TxtHidden.Value
Case Else
strX = Left(TxtHidden.Value, Len(Trim(TxtHidden.Value)) -
2) & "." & Right(TxtHidden.Value, 2)
End Select


Me.LabelDisplay.Caption = Format(strX, "$0.00")
End Sub
 
D

Douglas J Steele

I don't see where you're typing in anything: the value in TxtHidden is
getting the digit 1 concatenated to it each time you click on Image1.

Try putting a MsgBox Me.TxtHidden directly in front of the Select Case
statement, just to confirm that TxtHidden contains what you think it does.
 
D

DS

Douglas said:
I don't see where you're typing in anything: the value in TxtHidden is
getting the digit 1 concatenated to it each time you click on Image1.

Try putting a MsgBox Me.TxtHidden directly in front of the Select Case
statement, just to confirm that TxtHidden contains what you think it does.
Thanks Doug, I figured out the problem. The thing works fine I was
missing a field that passes the value along. And yes you were correct,
It's a click on not a type in. Thank you for your input.
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top