Forums
This topic is locked
IF. .Then evaluation of Recordset Data
Posted 09 May 2003 20:39:32
1
has voted
09 May 2003 20:39:32 Brian Canterbury posted:
Hello All,I am trying to conditionally test a recordset value. I am using a recordset to generate an HTML form. If the value is not equal to a certain value, I don't want to generate a form field for that item. For some reason my logic isn't working. What are your thoughts. Here is the code
<pre id=code><font face=courier size=2 id=code>
IF rsFields.Item("Name".Value <> StoreNum Then
'Code to make form fields
END IF
</font id=code></pre id=code>
When this code executes, every possible value passes the test. I know for a fact that the StoreNum value is in the recordset.
Any ideas?
Replies
Replied 09 May 2003 20:55:47
09 May 2003 20:55:47 Jonathan Danylko replied:
try this...
IF rsFields.FIELDS.Item("Name".Value <> StoreNum Then
'Code to make form fields
END IF
I think you were just missing the Fields property.
Hope this helps.
L8R,
Vitoman, M CIW D, MMCP
IF rsFields.FIELDS.Item("Name".Value <> StoreNum Then
'Code to make form fields
END IF
I think you were just missing the Fields property.
Hope this helps.
L8R,
Vitoman, M CIW D, MMCP
Replied 09 May 2003 21:22:05
09 May 2003 21:22:05 Brian Canterbury replied:
Thanks for your reply. I was excited that that was the only problem. But I looked at my code. I do indeed, include the fields property in my actual code. I retyped it here instead of cutting and pasting.
Do you have any other idea as to why it wouldn't work?
Here is the actual code:
<pre id=code><font face=courier size=2 id=code>
'If rsFields.fields.Item("Name".Value <> StoreNum THEN
Response.Write("<tr class="+chr(34)+"tabledata"+ chr(34)+"><td>"+ rsFields.fields.Item("Name".Value + ":</td>" + "<td><input name="+chr(34)+rsFields.fields.Item("Name".value+chr(34) + " type="+chr(34)+"text"+chr(34)+ " value=" +chr(34)+strPreApproveData+chr(34)+"></td></tr>"
'End IF
</font id=code></pre id=code>
Do you have any other idea as to why it wouldn't work?
Here is the actual code:
<pre id=code><font face=courier size=2 id=code>
'If rsFields.fields.Item("Name".Value <> StoreNum THEN
Response.Write("<tr class="+chr(34)+"tabledata"+ chr(34)+"><td>"+ rsFields.fields.Item("Name".Value + ":</td>" + "<td><input name="+chr(34)+rsFields.fields.Item("Name".value+chr(34) + " type="+chr(34)+"text"+chr(34)+ " value=" +chr(34)+strPreApproveData+chr(34)+"></td></tr>"
'End IF
</font id=code></pre id=code>
Replied 10 May 2003 00:19:07
10 May 2003 00:19:07 Brian Canterbury replied:
Ok, the problem was that I forgot to enclose my IF condition in quotes.
OOOPS!!!
It should have read as follows:
Thanks for looking at my post. <pre id=code><font face=courier size=2 id=code>
IF rsFields.FIELDS.Item("Name".Value <><font color=red>"</font id=red>StoreNum<font color=red>"</font id=red> Then
'Code to make form fields
END IF
</font id=code></pre id=code><font color=red></font id=red><font color=black></font id=black>
OOOPS!!!
It should have read as follows:
Thanks for looking at my post. <pre id=code><font face=courier size=2 id=code>
IF rsFields.FIELDS.Item("Name".Value <><font color=red>"</font id=red>StoreNum<font color=red>"</font id=red> Then
'Code to make form fields
END IF
</font id=code></pre id=code><font color=red></font id=red><font color=black></font id=black>
Replied 10 May 2003 22:07:08
10 May 2003 22:07:08 Jonathan Danylko replied:
DOH!
No problem. <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
L8R,
Vitoman, M CIW D, MMCP
No problem. <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
L8R,
Vitoman, M CIW D, MMCP