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

Contolling visibility of one field based on the value of another 1

Status
Not open for further replies.

kav123

Programmer
Jan 12, 2005
210
GB
I have a query, a select query which returns a recordset based on two input parameters. However, there is another condition that needs to be met. There is one field called 'PerformanceCriteria', which is Yes/No field. And based on the value of this field, another field'PerformanceAchieved', from the same table is displayed/not displayed on the ASP web page.

Is there a way, i can achieve this, in Access queries itself?? Can i control when a particular field should be returned in the recordset, based on the value of another field in the same table. This condition is in addition to two input parameters, which are used in the where clause of the query to select the records.

 
Well, not directly, but you can create an expression that would do it:
Code:
PerfAchieved: IIf([Performance Criteria], [PerformanceAchieved], "")

Ken S.
 
i.e. If i write a query like Select tblSomeTable.* from where lPID=@lPId and lOptionId=@lOptionId;, where should i put the If condition?? Can you please elaborate on that??

 
I think, you are telling me to write this expression, in the design view, and always the field would be returned, and based on the value of what you get, i would control the display of that particular page in the ASP page??
 
Yes, in the QBE grid, enter the expression in the "Field" field in a blank column. When you run the query this will generate a field called "PerfAchieved" which will return either the value of [Performance Achieved] or a null string, depending on the value of [Performance Criteria].

Ken S.
 
Thanks, that did work out well!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top