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

Response Write If Using Datebase Field in Access

Status
Not open for further replies.

terepan

Programmer
Oct 10, 2004
6
US
HI!

I have announcements down the left hand column of a site and want to display contact info if it is available - if it is entered into the database. So I only want to display a space plus the data if there is data in the field.

I am using Access and ASP/VBScript.

The contact info normally would appear like:
Ron Smith 972-456-7899 email <programmed in their email>

And if there is nothing in the database, then I want to leave it blank and take out the space I right now have between the database fields

The recordset I am pulling from is rsAnnounce and the database fields are:
acontact aphone aemail


Here is the coding
Code:
<tr>
<td align="left" valign="top"><p><%=(rsAnnounce.Fields.Item("acontact").Value)%>&nbsp;<%=(rsAnnounce.Fields.Item("aphone").Value)%>&nbsp;<a href="mailto:<%=(rsAnnounce.Fields.Item("aemail").Value)%>"><font color="999999">email</font></a></p></td>
</tr>
<tr>

Thanks for your help!

Healthy regards,

Teresa
 
Just put your db stuff in variables
Code:
Dim acontact


'# db loop stuff here

acontact = rsAnnounce.Fields.Item("acontact").Value
'# do the rest of the db values here..

If acontact <> "" then
 acontact = acontact & "&nbsp;"
  Else
 acontact = ""
End If

'#... and so on w/ the rest of it........

Response.write (acontact & aphone & aemail)


Jason

www.sitesd.com
ASP WEB DEVELOPMENT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top