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

text box is returning with #Error

Status
Not open for further replies.

47redlands

Programmer
Mar 9, 2010
62
GB
I have a textfield and I want the text field to return the price of seats form frmFindSeats. If I type this in the control source for the textfield it will work =[Forms]![frmFindSeats]![txtSeatPrice]
It returns the seat price of £12

However I need to check if the customer is a friend if so reduce the price by 10% (note I am also checking for null values) but the code does not work. It returns with #Error in side the text box

=IIf([Friend]=TRUE,nz([Forms]![frmFindSeats]![txtSeatPrice],0)*0.9,nz([Forms]![frmFindSeats]![txtSeatPrice],0))
 
I typically try to avoid pulling values from controls on one form into controls on another form. Usually you can pull values from tables or queries.

Does this work:
Code:
=IIf([Friend]=TRUE,0.9,1) * nz([Forms]![frmFindSeats]![txtSeatPrice],0)

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top