Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Omitt records from Repeat Region

Posted 23 Aug 2004 07:04:09
1
has voted
23 Aug 2004 07:04:09 Charles Knight posted:
Hi all

Wonder if you can help.

Need to create a repeat region from a recordset but omitt records that have a certain value in one colum.

Anyone any ideas

Cheers
ck

Replies

Replied 23 Aug 2004 08:02:10
23 Aug 2004 08:02:10 Dan Berdusco replied:
You can just use a simple If - Then statement:

<pre id=code><font face=courier size=2 id=code>&lt;%If NOT (RS_Name.Fields.Item("FieldName".Value) = "Your value" Then %&gt; </font id=code></pre id=code>
Put your stuff here that you want to show/hide.
<pre id=code><font face=courier size=2 id=code>&lt;% End If %&gt; </font id=code></pre id=code>

That will check so see if the value of a certain field in your database is equal to a specific value. If it is, then it will skip that record.

Replied 23 Aug 2004 08:18:04
23 Aug 2004 08:18:04 Charles Knight replied:
Wow that was quick.
I tried this:

&lt;%If NOT (RSCat3Details.Fields.Item("completed".Value) = "yes" Then %&gt;
&lt;%=(rsCa3Details.Fields.Item("cat3_id".Value)%&gt;&lt;/td&gt;
&lt;% End If %&gt;

but get error object require, any thoughts.

I tried another way by filtering the recordset to show only those records which do meet the critera and then repeat those.

Which is the correct way or is'nt there one ?

Cheers
ck
Replied 23 Aug 2004 18:46:46
23 Aug 2004 18:46:46 Dan Berdusco replied:
Either way will work. In fact, you are probably better off to just filter the recordset to begin with...

however, you may want to make the "if" statement work properly... Is the "Yes" you are referring to an MS Access Checkbox? If so, then use this statement:

<pre id=code><font face=courier size=2 id=code>&lt;%If NOT (RS_Name.Fields.Item("FieldName".Value) = True Then %&gt; </font id=code></pre id=code>

There should be no quotes around the True.
Replied 24 Aug 2004 02:17:32
24 Aug 2004 02:17:32 Charles Knight replied:
Thanks for the advice, the field is a dropdown yes/no. Will try the alternative code and let you know.
Cheers
ck

Reply to this topic