Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

if... else don't work?

Posted on 2000-03-07
3
Medium Priority
?
149 Views
Last Modified: 2010-05-02
Is here something wrong:

Do While Data1.Recordset.EOF <> True
  If Data1.Recordset(1).Value = Null Then
    List1.AddItem Data1.Recordset(0)
  Else
    List1.AddItem Data1.Recordset(1)
  End If
   
  Data1.Recordset.MoveNext
Loop

Even if there is NULL in Data1.Recordset(1).Value, List1.AddItem Data1.Recordset(0) never happen?
0
Comment
Question by:majala
[X]
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
3 Comments
 
LVL 2

Accepted Solution

by:
damienm earned 150 total points
ID: 2591136
Use

If IsNull(Data1.Recordset(1).Value) then

instead of Data1.Recordset(1).Value = Null
0
 
LVL 4

Expert Comment

by:wesleystewart
ID: 2591782
damienm is correct.  You can't test for null with "= Null" because the right side of the equation will ALWAYS evaluate to False.

Wes
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2592538
Assuming Data1.Recordset(1).Value is a String.. A better way to do this test (and more efficient) is to just test the length of it.. <smile>

If Len(Data1.Recordset(1).Value) > 0 _
Then
  List1.AddItem Data1.Recordset(1)
Else
  List1.AddItem Data1.Recordset(0)
End If
     
 
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

604 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