msgbox formatting

NigelShaw

Registered User.
Local time
Today, 01:22
Joined
Jan 11, 2008
Messages
1,572
Hi,

how can i format messagebox text? my code reads-

Private Sub PayBox_Exit()

' check PayBox for Value
If Me![Paybox].value = "" Then
' if no value then set figure to deducted
Me![total].value =Me![payable]![deductedValue

else
' otherwise add paybox to deducted
me![total].value = me![payable]![deducted].value + me![paybox].value
end if

' get the final total value
gotFullValue = me![Total].value

MsgBox ("The Amount to pay is " & gotFullValue), vbOKOnly

End Sub

when the message box shows, the figure retrieved is shown as 1234.8 but i would like it to show £1,234.80

all boxes with figures in are setwith format to currency so how can i change the format in the message box?

many thanks,


nigel
 
Insert:
FormatCurrency(gotFullValue)
before your MsgBox()
 
Hi,

i tried that but got errors. to confirm then, do i place the formatcurrency(variable) like this-
Formatcurrency(gotfullvalue)msgbox(("The Amount to pay is " & gotFullValue), vbOKOnly

this gave me errors.

otherwise, what would the format be? sorry to be a pain


Nigel
 
Actually,

is it-

MsgBox ("The Amount to pay is " & FormatCurrency(gotFullValue)), vbOKOnly

regs,

Nigel
 
try this:
Code:
Private Sub PayBox_Exit()
    Dim gotFullValue as Variant
 
    ' check PayBox for Value
    If Me![Paybox].value = "" Then  
        ' if no value then set figure to deducted
        Me![total].value =Me![payable]![deductedValue
      else
        ' otherwise add paybox to deducted
        me![total].value = me![payable]![deducted].value + me![paybox].value
    end if
 
    ' get the final total value
    gotFullValue = me![Total].value

    ' format to display as currency
    gotFullValue = FormatCurrency(gotFullValue)

    ' Display the msg
    MsgBox ("The Amount to pay is " & gotFullValue), vbOKOnly
 
End Sub
 

Users who are viewing this thread

Back
Top Bottom