code builder If..then

  • Thread starter Thread starter mark R
  • Start date Start date
M

mark R

I would like to look at examples of building code
If the QUERYFIELD is male then print M at this grid
location on the report other wise print F at this other
grid location on the report.
 
Create a text box, and control source will have an
expression like:

=IIF(QUERYFIELD = 'male',"M","F")

Just have to be concerned if QUERYFIELD is blank?
 
Mark,

There is no need for code in this instance. You can do this either
within the query that the report is based on, by making two calculated
fields such as...
MM: IIf([QUERYFIELD]="male","M")
FF: IIf([QUERYFIELD]<>"male","F")
.... and then add textboxes to the report in the required positions which
are bound to these columns in the query. Or you can put unbound
textboxes on the report, and use similar expression e.g.
=IIf([QUERYFIELD]="male","M") in the Control Source property of the textbox.
 
Back
Top