Format within Query

ViRi

Registered User.
Local time
Today, 14:30
Joined
Jan 31, 2006
Messages
44
Hi

I have a Query that calculates a value SubTotal using one of two values depending on the state of a check box called Euro.

Code:
SubTotal: IIf([Euro]=True,[Quantity]*([UnitPrice]*[ExchangeRate])-[Discount],[Quantity]*[UnitPrice]-[Discount])

This works fine. The value is calculated correctly.

I now need to include the currency sign be it either € or
£ in front of the value generated according to the state of Euro. If Euro is True then € if not True then £

Euro is set by clicking on one of two command buttons btnEuro or btnGBP.


ViRi
 
Why not do this in your form where you display the data. This will work much better than doing it in the query.
 
Hi

Any idea on how to go about this.

ViRi
 
Hi

I've tried this code on the On Current Event of the subform. It works for the first record once the Form is refreshed, only to change back once the Form is refreshed again by selecting a new record for example.

Code:
Private Sub Form_Current()

If Me.Euro = True Then
Me.Total.Format = "€0.00"
Else
Me.SubTotal.Format = "£0.00"
End If

DoCmd.RunCommand acCmdSaveRecord


End Sub

ViRi
 

Users who are viewing this thread

Back
Top Bottom