Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

syntax help with VB Script

Posted on 2013-06-24
3
357 Views
Last Modified: 2013-06-24
I have three conditions to show a region.

1. Show IF the recordset is empty
2. Show IF the recordset IS NOT empty AND the value of 'email' = 1

This is what I got so far:

for 1:  

<% If Qnrpg1.EOF And Qnrpg1.BOF Then %>

for 2:  

<% If (Not Qnrpg1.EOF Or Not Qnrpg1.BOF) AND (Qnrpg1.Fields.Item("email").Value = "1")) Then %>

The second one gives me the following syntax error:

Expected 'Then'

/bluedot/questionnaire/QnrPersonalInfo.asp, line 626

If (Qnrpg1.Fields.Item("email").Value = "1")) Then

-----

so two things:   First fix the syntax error, second put both conditions together in one.

I close the above with

 <% End If  %>
0
Comment
Question by:amucinobluedot
3 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39271442
<%If (Qnrpg1.EOF And Qnrpg1.BOF) Or ((Not Qnrpg1.EOF Or Not Qnrpg1.BOF) AND (Qnrpg1.Fields.Item("email").Value = "1")) Then %>

 <% End If  %>

Open in new window

0
 

Author Closing Comment

by:amucinobluedot
ID: 39271470
:)
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39271499
I think you will get an error for testing a value when the rs is empty and therefor, I use two lines.  I also convert the field to a string to make sure we are not mixing up alpha and numeric.
x="no"
If not Qnrpg1.EOF OR not Qnrpg1.BOF Then 
     if cstr(Qnrpg1.Fields.Item("email").Value) = "1"
         x="yes"
     end if
end if
response.write x

Open in new window

0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question