Change display values for fields

S

Susan G

Ok, I am new to this. I am displaying data from a access database on a
page. I am using the DRW to retrieve data based on criteria. What I can't
seem to do is display a different value for a field based on a specific
value. i.e. - I want to display the email addresses if PubEmail = 'Yes',
but display "non-published" if PubEmail is 'No'.

I have tried to add a SQL statement to Custom Query, but everything I try
results in an error.

I appreciate any/all help.
 
J

Jon Spivey

Hi,

The SQL would be (I'm assuming Access here)

SELECT Field1, Field2, IIF(PubEmail='Yes', EmailAddressField, 'Not
Published') AS EmailAddress
FROM YourTable

Just change the field/table names to suit and enter this as a Custom Query -
wizard step 2.

Jon
 
T

Thomas A. Rowe

If the PubEmail is a Yes/No field, then you have to test for it using:

<If rs("PubEmail") = YES Then %><a href="mailto:<%=rs("Email")%>"><%=rs("Email")%></a><% Else
%>non-published<% End If %>

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
Top