Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting for Currency - results label

Status
Not open for further replies.

Milin

Technical User
Jan 5, 2000
33
US
I still can't make this thing work!!!<br>
I've tried what I find in books to make the final resulting calculation (in LblEI.Caption) format for currency, but I can't get it to do it. As it's set up, I get a &quot;.&quot; instead of a &quot;,&quot; and if the last number in the answer is a &quot;0&quot; it drops it. Also, sometimes the answer will go to 4 decimal places. I've figured everything else out except for this.<br>
What I want is &quot;$###,###&quot; as a format. The numbers used for this calc are not currency, but I want the final result to be currency.<br>
Thanks!<br>
<br>
<br>
' if attendance is greater than peakroomcount<br>
' multiply peakroomcount by 1.8<br>
' whichever is less - attendance or new peakroomcount and multiply * 1.451<br>
<br>
Private Sub BookingFormula2()<br>
Dim Vara<br>
Dim Varprc&<br>
Dim Xprv<br>
Vara = Val(TxtAttend.Text)<br>
Varprc = Val(TxtPRC.Text)<br>
Xprv = Varprc * 1.8<br>
<br>
If Vara &gt; Varprc Then<br>
Xprv = Varprc * 1.8<br>
If Vara &lt; Xprv Then<br>
LblEI.Caption = Vara * 1.451<br>
Else: LblEI.Caption = Xprv * 1.451<br>
<br>
End If<br>
End If<br>
End Sub<br>
<br>

 
try this<br>
#,###.00<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Thanks DougP, but it still wouldn't work - am I writing it wrong?<br>
<br>
After the LblEI.Caption lines, I write...<br>
LblEI.Caption = Format(Vara, &quot;#,###.00)<br>
LblEI.Caption = Format(Xprv, &quot;#,###.00)<br>
<br>
As an example, when I plug in 100 and 50 for my two numbers, the LblEI.Caption says 130.59 --- what I want is 130,590 or at least 130.590<br>
<br>
Another example is when I plug in 150 and 78, I get 203.7204 -- I need least 203.720 or 203,720<br>
<br>
Thanks!
 
ok - have you tried<br>
<br>
#,###.000 ' more zeroes after the .<br>
<br>
? <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
I've plugged in both of your suggestions, but it somehow wreaks the formula - I get totally different results in LblEI. <br>
<br>
Any other thoughts out there?<br>
This is so frustrating -- I'm so close to success!<br>
<br>
Thanks
 
and here is something else to try<br>
<br>
------------------------<br>
This example uses the CCur function to convert an expression to a Currency.<br>
<br>
Dim MyDouble, MyCurr<br>
MyDouble = 543.214588 ' MyDouble is a Double.<br>
MyCurr = CCur(MyDouble * 2) ' Convert result of MyDouble * 2<br>
' (1086.429176) to a <br>
' Currency (1086.4292).<br>
----------------------------<br>
then format the Result <br>
= Format(MyCurr ,&quot;$##0.00&quot;)<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top