I am trying to currency format a label field (the final calculated result--LblEI.Caption) in a small calculator program I have written. I keep going over and over solutions in my books to try to make this label format the result as currency. The closest I can get it is below -- I really want the format as $###,### Can someone give me what I'm sure is an easy solution? Is it because my variables are not formatted correctly?<br>
Thanks so much!<br>
<br>
Private Sub BtnCalc_Click()<br>
<br>
Dim Vara 'Attendance entry<br>
Dim Varprc 'Peak Room Count entry<br>
Dim EI 'EI if Attendance and PRC are equal<br>
<br>
'declare variables<br>
Vara = Val(TxtAttend.Text) 'Attendance<br>
Varprc = Val(TxtPRC.Text) ' Peak Room Count<br>
EI = Vara * 1.451<br>
<br>
If (Vara = Varprc) Then<br>
LblEI.Caption = EI<br>
LblEI.Caption = Format(EI, "$###,###.000"<br>
<br>
Else: Call BookingFormula1<br>
End If<br>
' If attendance and Peak Room Count are equal,<br>
' there is a straight calculation -- the EI variable.<br>
' If the values are not equal, BookingFormula1 is called<br>
End Sub<br>
<br>
<br>
Private Sub BookingFormula1()<br>
Dim Vara ' Attendance from above<br>
Dim Varprc& 'Peak Room Count from above<br>
Dim XPrv ' adjusted Peak Room Count<br>
Vara = Val(TxtAttend.Text) 'Attendance<br>
Varprc = Val(TxtPRC.Text) 'Peak Room COunt<br>
XPrv = Varprc * 1.8 'Adjusted Peak Room Count<br>
<br>
If XPrv < Vara Then<br>
LblEI.Caption = XPrv * 1.451<br>
LblEI.Caption = Format(XPrv, "$###,###.000"<br>
Else: LblEI.Caption = Vara * 1.451<br>
LblEI.Caption = Format(Vara, "$###,###.000"<br>
End If<br>
<br>
' if the Adjusted peak room count is less than Attendance<br>
' then multiply aprc x 1.451 else, muliply attendance x 1.451<br>
<br>
End Sub<br>
<br>
<br>
Thanks so much!<br>
<br>
Private Sub BtnCalc_Click()<br>
<br>
Dim Vara 'Attendance entry<br>
Dim Varprc 'Peak Room Count entry<br>
Dim EI 'EI if Attendance and PRC are equal<br>
<br>
'declare variables<br>
Vara = Val(TxtAttend.Text) 'Attendance<br>
Varprc = Val(TxtPRC.Text) ' Peak Room Count<br>
EI = Vara * 1.451<br>
<br>
If (Vara = Varprc) Then<br>
LblEI.Caption = EI<br>
LblEI.Caption = Format(EI, "$###,###.000"<br>
<br>
Else: Call BookingFormula1<br>
End If<br>
' If attendance and Peak Room Count are equal,<br>
' there is a straight calculation -- the EI variable.<br>
' If the values are not equal, BookingFormula1 is called<br>
End Sub<br>
<br>
<br>
Private Sub BookingFormula1()<br>
Dim Vara ' Attendance from above<br>
Dim Varprc& 'Peak Room Count from above<br>
Dim XPrv ' adjusted Peak Room Count<br>
Vara = Val(TxtAttend.Text) 'Attendance<br>
Varprc = Val(TxtPRC.Text) 'Peak Room COunt<br>
XPrv = Varprc * 1.8 'Adjusted Peak Room Count<br>
<br>
If XPrv < Vara Then<br>
LblEI.Caption = XPrv * 1.451<br>
LblEI.Caption = Format(XPrv, "$###,###.000"<br>
Else: LblEI.Caption = Vara * 1.451<br>
LblEI.Caption = Format(Vara, "$###,###.000"<br>
End If<br>
<br>
' if the Adjusted peak room count is less than Attendance<br>
' then multiply aprc x 1.451 else, muliply attendance x 1.451<br>
<br>
End Sub<br>
<br>
<br>