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

Formatting based on another field 1

Status
Not open for further replies.

alexthomas

Technical User
Jul 22, 2004
7
US
Hi.

I have a report which displays drug records with fields such as drug name, rebate price etc. For a particular drug name "ABC", I want to display "N/A" for the rebate price field. How do I do this on the report? and where do I write the conditional code that checks the value of one field and sets the display of another field based on that? I guess, if its possible, I need to have a loop that iterates through all the records. Pls help.

Thanks
alex
 
One way of doing this, is keeping your current textcontrol which is bound to your rebate field, but make it invisible (let's say the controls name is txtRebate).

Then create another text control. You can then either use a controlsource of something like the following:

[tt]=iif(txtName="ABC","N/A",txtRebate)[/tt]

- where Access will put in some appropriate [brackets], or you can use the on format event where the control resides, and do the same:

[tt]if (me("txtName").value)="ABC" then
me("txtNewBox").value="N/A"
else
me("txtNewBox").value=me("txtRebate").value
end if[/tt]

Roy-Vidar
 
Hi Roy,

It worked ! Thanks for your help and I really appreciate it. I am new to access reports and thanks to experts like you, I am picking up !

Thanks again,
Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top