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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate a new value in a report footer

Status
Not open for further replies.

JurgenM

IS-IT--Management
May 1, 2003
5
CA
I have 4 total Txt Boxes in my report footer. They contain currancy values in Euros. I want to Populate 4 Lbl.captions with Canadian values for these txt values. I've run out of ideas.

Here is my last effort:
I = ChangeCurrency()
'textboxes are hidden in report detail section
LblCanRent.Caption = "$" & Val(TxtIrent.Text) / dEurotoCan
LblCanNk.Caption = "$" & Val(TxtINk.Text) / dEurotoCan
LblCanTotal.Caption = "$" & Val(TxtItotal.Text) / dEurotoCan
LblEuroCC.Caption = "€" & Val(TxtICan.Text) * dEurotoCan
ChangeCurrency() looks like this:
Public Function ChangeCurrency()
'load currenct exchange vals and open bassmai.
Dim Db As Database
Dim rsCurrency As Recordset

Set Db = CurrentDb()
Set rsCurrency = Db.OpenRecordset("currentexchange")

rsCurrency.OpenRecordset
dKronertoCan = rsCurrency.Fields(0)
dUStoCan = rsCurrency.Fields(1)
dEurotoCan = rsCurrency.Fields(2)
rsCurrency.Close
End Function

Thanks for any help
 
I would probably not use any code. Try use a text box rather than label. Set the control source to
= "$" & Val(TxtIrent) / DLookup("Field?", "CurrentExchange")
= "$" & Val(TxtINk) / DLookup("Field?", "CurrentExchange")
= "$" & Val(TxtItotal) / DLookup("Field?", "CurrentExchange")
= "$" & Val(TxtICan) / DLookup("Field?", "CurrentExchange")
Substitute your field name for "Field?".

Your code might have worked if you would have removed the ".Text" since this is a VB thing. Access actually uses the .Value property which is the default property so you can omit it.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top