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

Converting figures from a table based on a value entered on a form

Status
Not open for further replies.

prpleprncs

Programmer
Jul 12, 2002
14
VG
Hello, I have a report that prints values from a Invoicing database using US currency. When the invoice data is input, you can check a box to record the currecy- US or Euro. So I created a form that prompts for the invoice number that needs printing. If the currency for the invoice is Euro, then another textbox opens promting for the exchange rate. All of this works.

I have a query that searches for an amount based on the invoice number. On the actual invoice there is a subreport that uses this value, but before it's place in the report it needs to be converted.

In the subreports on format mmethod, I have the following code:

Code:
Report_DisbursmentsValueSubRpt.txtValue1 = IIf([Forms]![Print_Invoice]![tbCurrency], Forms!Print_Invoice!tbCurrency * [txtValue], [txtValue])

I have a bound field, txtValue,that holds the value from the database and an unbound field,txtValue1, that displays the value.

This works fine except for one part. Multiple records are returned, but the unbound field only has the value of the converted first record returned. When I step through the code, it never makes it to subsequent records returned. Only the first record is being read and converted even though it runs the line of code the same number of times as the number of records returned. What am I doing wrong?
 
Never mind. I got it. I wasn't using the database field name correctly. Basically I used the iif function in my query and changed txtValue to the actual database field name and it worked perfectly.

amt: IIf([Forms]![Print_Invoice]![tbCurrency],[Forms]![Print_Invoice]![tbCurrency]*[FeeDisbursement.FeeDisbursement_Amount],[FeeDisbursement.FeeDisbursement_Amount])

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top