Forums

This topic is locked

link not active if empity

Posted 10 Mar 2002 14:16:12
1
has voted
10 Mar 2002 14:16:12 arrigo arrigo posted:
I'm developing a group of pages based on a access db.
The page I'm courently working on is located at:
www.sthink.com/miriamplace/bands.asp

This page has a table that correspond to the DB table named 'bands'. It shows all the coloumns except for the 'website' column wich contains the URLs that the 'band' column uses for make the diferent names become a link ti the band's website.
OK?
So, why tha name is still a link (to nowhere) when there is no URL in the corrisponding cell?
Here I paste the cell's code, many thanks for help

<h2 align="center">
<% If Not bands.EOF Or Not bands.BOF Then %>
<a href="<%=(bands.Fields.Item("website".Value)%>" target="_blank"><%= UCase((bands.Fields.Item("band".Value)) %></a>
<% Else %>
<%= UCase((bands.Fields.Item("band".Value)) %>
<% End If ' end Not bands.EOF Or NOT bands.BOF %>
</h2>
</td>

Replies

Replied 10 Mar 2002 14:42:14
10 Mar 2002 14:42:14 Owen Eastwick replied:
Problem is with your condition:

<% If Not bands.EOF Or Not bands.BOF Then %>

Unless the entire recordset (bands) is empty this condition will be true, so you get:

<a href="<%=(bands.Fields.Item("website".Value)%>" target="_blank"><%= UCase((bands.Fields.Item("band".Value)) %></a>

Try this instead:

<h2 align="center">
<% If (bands.Fields.Item("website".Value) <> "" Then %>
<a href="<%=(bands.Fields.Item("website".Value)%>" target="_blank"><%= UCase((bands.Fields.Item("band".Value)) %></a>
<% Else %>
<%= UCase((bands.Fields.Item("band".Value)) %>
<% End If %>
</h2>



Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 10 Mar 2002 18:12:51
10 Mar 2002 18:12:51 arrigo arrigo replied:
it worked out just perfect! many thanks
I owe you a beer whenever in italy (venice)
www.sthink.com/miriamplace/bands.asp
thanks!

<img src=../images/dmxzone/forum/icon_smile_cool.gif border=0 align=middle>

Reply to this topic